I have written servlet to access the ejb methods.i got compilation error p
Hello Everybody,
i very new to weblogic server 8.1.i have written a servlet to access ejb(SignOn) method validateUser(username,password).when ever i compile it shows package not found exception.
Please any one help me.
Thanks in advance
riaz
I put my servlet code here
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import javax.naming.*;
import javax.ejb.*;
import demo.*;
import javax.rmi.PortableRemoteObject;
public class SessionTestServlet extends HttpServlet {
SignOnHome signOnHome;
SignOn signOn=null;
public void init(ServletConfig config) throws ServletException {
//Look up home interface
try {
InitialContext ctx = new InitialContext();
Object objref = ctx.lookup("demo/SignOn");
signOnHome = (SignOnHome)PortableRemoteObject.narrow(objref,SignOnHome.class);
} catch (Exception NamingException) {
NamingException.printStackTrace();
public void doGet (HttpServletRequest request,HttpServletResponse response)
throws ServletException, IOException
PrintWriter out;
response.setContentType("text/html");
String title = "EJB Example";
out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Hello World Servlet!</title>");
out.println("</head>");
out.println("<body>");
out.println("<p align=\"center\"><font size=\"4\" color=\"#000080\">Servlet Calling Session Bean</font></p>");
try{
// MyTestSession beanRemote;
SignOn signOn;
signOn = (SignOn)signOnHome.create();
out.println("<p align=\"center\"> Message from Session Bean is: <b>" + signOn.SayHello() + "</b></p>");
signOn.remove();
}catch(Exception CreateException){
CreateException.printStackTrace();
out.println("<p align=\"center\"><a href=\"javascript:history.back()\">Go to Home</a></p>");
out.println("</body>");
out.println("</html>");
out.close();
public void destroy() {
System.out.println("Destroy");
exception:
SessionTestServlet .java:13: class SessionTestServlet is public, should be decla
red in a file named SessionTestServlet.java
public class SessionTestServlet extends HttpServlet {
^
SessionTestServlet .java:2: package javax.servlet does not exist
import javax.servlet.*;
^
SessionTestServlet .java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
SessionTestServlet .java:7: package javax.ejb does not exist
import javax.ejb.*;
^
SessionTestServlet .java:8: package demo does not exist
import demo.*;
^
SessionTestServlet .java:13: cannot find symbol
SessionTestServlet .java:13: class SessionTestServlet
is public, should be decla
red in a file named SessionTestServlet.java
public class SessionTestServlet extends HttpServlet
^You servlet should be placed in SessionTestServlet.java. The source file name should match the class name since the class is public.
SessionTestServlet .java:2: package javax.servlet
does not exist
import javax.servlet.*;
^
SessionTestServlet .java:3: package
javax.servlet.http does not exist
import javax.servlet.http.*;
^
SessionTestServlet .java:7: package javax.ejb does
not exist
import javax.ejb.*;
^
SessionTestServlet .java:8: package demo does not
exist
import demo.*;
^
SessionTestServlet .java:13: cannot find symbolThese errors indicate that you haven't set the ClassPath correctly.
Add the weblogic.jar with the correct path to your classpath and compile.
Regards,
***Annie***
Similar Messages
-
Having problem access the EJB 3 from Web Component
Hi ,
I have an EJB 3 entity AuctionItem and a session ItemProcessor only implements the local interface IItemProcessor, then I use a servlet to access the findAll method in the ItemProcessor. I've created a Enterprise Applicaiton project to contain the ejb jar and the war file, but after I deploy the ear successfully, I couldn't access to my servlet through http://localhost:8080/AuctionWeb/AuctionServlet, it keeps giving me error like follwoing. Do you know why, your help will be very appreciated !
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
java.lang.NullPointerException
at web.AuctionServlet.doGet(AuctionServlet.java:43)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
My code sample:
public class AuctionServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
@EJB
private IItemProcessor itemProcessor;
public AuctionServlet() {
super();
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet AuctionServlet</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet AuctionServlet at " + request.getContextPath () + "</h1>");
List items = itemProcessor.findAll();
for (Iterator it = items.iterator(); it.hasNext();) {
AuctionItem elem = (AuctionItem) it.next();
out.println(" <b>"+elem.getItemid()+" </b><br />");
out.println(elem.getTitle()+"<br /> ");
out.println("</body>");
out.println("</html>");
.....And the session bean is :
package sessions;
import javax.annotation.Resource;
import javax.ejb.Local;
import javax.ejb.Stateless;
import javax.persistence.*;
import javax.sql.DataSource;
import java.util.List;
import entities.AuctionItem;
@Stateless(name = "ItemProcessor")
public class ItemProcessor implements sessions.IItemProcessor {
@PersistenceContext
EntityManager entityManager;
public Long createItem(String title, Double value, String description,
String status) {
AuctionItem item = new AuctionItem();
item.setTitle(title);
item.setValue(value);
item.setDescription(description);
item.setStatus(status);
entityManager.persist(item);
return item.getItemid();
public String findItemByKey(Long id) {
AuctionItem item = entityManager.find(AuctionItem.class, id);
return item.getTitle();
public List findAll() {
return entityManager.createQuery("select object(o) from AuctionItem as o").getResultList();
}The most common reason for this failure is if your web.xml does not refer to the latest web application
.xsd :
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http
://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/x
ml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
Otherwise, the web application is considered to be a J2EE 1.4 application and annotations
are not processed. If that's not the case you can also run the application through the
verifier to see if it identifies any issues. -
How can i access the EJB from a Webdynpro
Dear all,
How can i access the ejb , from a webdynpro?.
Is there any way to do that?.
I want to write the entire code (business functions) within the EJB and i wan to access the entire methods from a WebDynpro Application.This is the situation.
Please help me to , resolve this problem.(Here im using JDBC Connection .. etc.).
I want to do the basic connection setting's and data retrieval part within the EJB and use that within the WebDynpro..
how can i seperate this two(i mean, i want to seperate the JDBC connections and WebDynpro,i dont want to hard code any connection parameters within the webdynpro code)
So that i want use that saet of particular function's in many webdynpro applications..
(i dont need any help regarding webservice way.)
If anyone can , please help me..
I tried that javabean class , manifest file , that way (importing javabean model).
but im getting errors.
I cant properly utilize that..
So please help me with steps regarding that,,
for javabean
and if any , for EJB also..
with regards
Kishor.GHI,
Since webdynpros follows Model View Controller Architecture You can access EJBs in webdynpro(views/frontend) infact to connec to database uding JDBC you have to utilise EJB ( opening connection to database closing, and other Business functionality).See this link
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/unkown/web dynpro tutorial and sample applications.faq#q-7
<b>How to access the Car Rental Web Service?</b>
Regards,
RK -
How to access the ejb using WSIF
I have deployed my Bean Managed Persistance Entity Bean in Weblogic 8.1 App Server. Trying to access the ejb from Synchronous BPEL process using WSIF. I am getting following error
- WSIF0011I: Preferred port 'EJBPort' was not available
org.apache.wsif.WSIFException: Unable to find an available port
at org.apache.wsif.base.WSIFServiceImpl.getPort(Unknown Source)
at org.apache.wsif.base.WSIFServiceImpl.getPort(Unknown Source)
at com.test.wsif.RunInventory.main(RunInventory.java:55)
How to resolve the above said problem??
Here is my Inventory.wsdl file
<?xml version="1.0" ?>
<definitions targetNamespace="http://wsifservice.Inventory/"
xmlns:tns="http://wsifservice.Inventory/"
xmlns:typens="http://wsiftypes.addressbook.service.ejb/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/"
xmlns:ejb="http://schemas.xmlsoap.org/wsdl/ejb/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<!-- type defs -->
<types>
<xsd:schema
targetNamespace="http://wsiftypes.addressbook.service.ejb/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<xsd:complexType name="vecdetails">
<xsd:sequence>
<xsd:element name="make" type="xsd:string"/>
<xsd:element name="bodystyle" type="xsd:string"/>
<xsd:element name="model" type="xsd:string"/>
<xsd:element name="quantity" type="xsd:int"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<!-- message declns -->
<message name="getInventoryRequestMessage">
<part name="vecdetails" type="typens:request"/>
</message>
<message name="getInventoryResponseMessage">
<part name="response" type="typens:response"/>
</message>
<!-- port type declns -->
<portType name="Inventory">
<operation name="getInventory">
<input name="getInventoryRequest" message="tns:getInventoryRequestMessage"/>
<output name="getInventoryResponse" message="tns:getInventoryResponseMessage"/>
</operation>
</portType>
<!-- binding declns -->
<binding name="EJBBinding" type="tns:Inventory">
<ejb:binding/>
<format:typeMapping encoding="Java" style="Java">
<format:typeMap typeName="xsd:string" formatType="java.lang.String" />
</format:typeMapping>
<operation name="getInventory">
<ejb:operation
methodName="getInventory"
parameterOrder="make bodystyle model quantity"
interface="remote" returnPart="response" />
<input name="getInventoryRequest"/>
<output name="getInventoryResponse"/>
</operation>
</binding>
<!-- service decln -->
<service name="InventoryService">
<port name="EJBPort" binding="tns:EJBBinding">
<!-- Put vendor-specific deployment information here -->
<ejb:address className="com.poc.inventoryejb.InventoryHome"
jndiName="Inventory"
initialContextFactory="weblogic.jndi.WLInitialContextFactory"
jndiProviderURL="t3://localhost:7001"/>
</port>
</service>
</definitions>Try to restart BPEL Server. When I tested WSIF Bindings I had to restart server after every changes in WSIF WSDL.
Alexey. -
Have uploaded and installed CC 2014. Several apps give this error when I try to start them: "Unable to launch Adobe InDesign as you do not have sufficient permissions to access the preferences folders"
-or-
The icon in the dock bounces once, and nothing happens.Windows or Mac, and exactly which operating system version?
-
I now have 5 devices that access the "cloud" via Match. I also have 3 computers that need to be authorized. Is there a way to authorize all these computers/devices in such a way to allow everything to access and sync to the cloud?
I had a problem with a 5.0.3 project that would cause 5.0.4 to crash. Apple asked for a copy of the project and later told me it was because there were some empty text layers. Apple is aware of the issue and is working on a fix.
In my case I still had 5.0.3 on another Mac and could clean up the project. If empty text layers might be the problem, do you know someone with an earlier version who could open it and remove the empty layers? I'd be willing to give it a try if you'd want to send me the project.
Ross Hunter -
Is it possible to have two DADs that access the same database?????
Hello,
Is it possible to have two DADs that access the same database?
One DAD would be password protected with Authentication mode Per Package and the other DAD would not require a password/login
If it is possible can you also give suggestions about how to do this
Thanks
DougI HAD THE SAME PROBLEM WITH SHARING MY LIBRARY WITH MY SON. WHAT I DID WIAS CREATED A LIBRARY FOR HIS USE ONLY. IN ITUNES CLICK--FILE--NEW PLAYLIST AND THIS SHOULD ADD AN UNTILED PLAY LIST IN YOUR SIDE BAR. CLICK ON IT AND RENAME IT. HE CAN KEEP ALL OF HIS MUSIC IN THIS LIBRARY. SELECT ALL OF HIS MUSIC FROM YOUR LIBRARY AND DRAG IT INTO HIS. ONCE THIS IS DONE YOU CAN THEN REMOVE HIS SONS FROM YOU PLAY LIST. MAKE SURE YOU ONE REMOVE IT FROM YOUR PLAY LIST AND NOT DELETE THE FILE.
HOPE THIS HELPS
G4 Mac OS X (10.3.9) -
After a recent iTunes update attempt iTunes no longer functions and the airport extreme base station is not accessable on our computer. We still have wifi but cannot access the base station software.
Thanks for the reply. I appreciate the response. I tried that approach this evening and it didn't work for me. (Technically it worked for me, when I was hardwired into my base station, but would not work for me wirelessly, which is my main issue.)
Again, using the approach you recommended works only if I have my ethernet cable attached to the LAN port so my computer is communicating directly to the base station through the hard wire. I am able to scan for my base station and make setting adjustments normally this way too.
As soon as I disconnect from the LAN port and try to go wireless is where I run into problems. The Base Station's wireless network I created is available to choose in the top right corner of the monitor with all of the other available wireless devices/networks -- but the network I created does not have access to the internet. I am also unable to configure my Base Station wirelessly. When my Airport Utility tries to scan for the Base Station and Network, it cannot find any Apple Wireless Device. It's like the Wireless Network in my base station is not sending out a signal.
Is there a way to resolve this issue? -
After updating Firefox yesterday I have been unable to access the internet. I have tried the Norton 360 fix several times, but it still doesn't work.
After updating Firefox yesterday I have been unable to access the internet. I have tried the Norton 360 fix several times, but it still doesn't work.
-
I recently have been unable to access the ITunes store. I am currently running ITunes version 11.0.3.42. Do I need to update to the current version of ITunes in order to connect to the ITunes store, or is there another reason I cannot connect?
Hello stephencadmaster,
Running the current version of iTunes is recommended. After reviewing your post, I have located an article that can help. It contains a number of troubleshooting steps and helpful advice concerning iTunes Store issues:
iTunes: Advanced iTunes Store troubleshooting
Thank you for contributing to Apple Support Communities.
Cheers,
BobbyD -
Whenever i try to access any folder on my computer(Windows 7), it tells me "Windows
cannot access the specified device, path, or file, you may not have appropriate permission to access the item",
this happens even for My
Computer and Control Panel. It's driving me nuts! I'll be honest here, I was trying to uninstall Visual
Studio 2013 Communityfrom my computer by going to Programs
and Features but for some reason, it was getting stuck at "Configuring
Your System". After trying it numerous times, I went to the visual studio installation directory, and removed
the installation files from there. I even removed the files from the C:\Program
Data folder, then i went back to Programs
and Features and tried to remove the listing there, but I got a dialog box saying "you
don't have sufficient access to uninstall visual studio" . I googled this problem and found this solution
(http://superuser.com/a/174198)
then i tried using the solution, I used SubinAcl and
changed the registry permissions as mentioned in the solution and ended up like this!
All the access permissions are set correctly (that's what I can make out...)
Please Help!Hi
Some required information are needed for us to help you.
Hi NabeelOmer,
We wonder if you have taken any action such as system restore after this issue occurred.
You might also try this command to restore your access control list.
Run this command to navigate to the drive letter, example is D
D:
To reset all permissions, run this command
icacls * /reset /t /c /q
Visual Studio is a very invasive program and which provides the ability to enumerate projects and solutions for system, user should never try uninstalling it manually without any guidance.
Visual Studio made changes for your whole system, if the file has been moved or deleted this error would occur.
Since you mentioned that you get this error almost everywhere even in control panel. We suggest you repair/reinstall your Visual Studio first and check if it could be fixed.
How to: Repair Visual Studio
https://msdn.microsoft.com/en-us/library/aa983433%28v=vs.90%29.aspx?f=255&MSPPError=-2147217396
Regards
D. Wu -
I have written a book with the ibooks application and I have gone through the process of publishing it through itunes to the itunes book store. Everything seems to work and i get to the end of the process and get a big green check. However, what now? How do I check to see if it actually got through to the book store or not?
Thanks.Hi khicks48,
Welcome to the Support Communities!
The article below will explains the publishing process for the iBookstore:
Apple - iTunes - Partner Programs - Book Publishers
I hope this information helps ....
Have a great day!
- Judy -
Getting support through this site is terrible. Having said that I have been trying to access the store in order to order PS CC and I have been unable to connect. I have an internet connection that works with everyone else. The URL comes up in the browse window and the address simply hangs. This has been going on for the past three hours.
Please read, and reply back here with information https://forums.adobe.com/thread/1499014
-and try some steps such as changing browsers and turning off your firewall for downloads
http://myleniumerrors.com/installation-and-licensing-problems/creative-cloud-error-codes-w ip/
http://helpx.adobe.com/creative-cloud/kb/failed-install-creative-cloud-desktop.html
BLANK Cloud Screen http://forums.adobe.com/message/5484303 may help
-and step by step http://forums.adobe.com/thread/1440508?tstart=0
-and http://helpx.adobe.com/creative-cloud/kb/blank-white-screen-ccp.html
Mac Spinning Wheel https://forums.adobe.com/message/5470608
-Similar in Windows https://forums.adobe.com/message/5853430 -
(264361962) Q ADVC-27 How do you pass the security info to access the EJB?
Q<ADVC-27> How do you pass the security info to access the EJB?
A<ADVC-27> Authentication for web service users must occur at the web layer. This
means providing appropriate web resource definitions and restrictions in the web.xml
file for your project. The most common and useful form of security for application
interaction is via client-side certificates. Then the client identity is transmitted
to the EJB is the same way as in regular J2EE environments. There is a complete description
on security on e-docs:
http://edocs.bea.com/workshop/docs70/help/guide/security/ovwSecurity.html
AdamYou need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
(119093) -
When I access the itunes store I get an error message saying that Itunes has detected a problem and has to be closed. The rest of Itunes is working fine... Any help?
There could be any number of items causing this. First off is do you have an active internet connection? If so have you tried rebooting you computer?
Maybe you are looking for
-
Please HELP I need to resize a PDF I have Professional 7
I was given a PDF 4" inches tall by 6" inches long. All I had to do is to increase the size to 5 and 1/8" inches tall x 8 and 3/4" long. I do not have access to the original file that created this PDF. So I was hoping that anyone would know if Pr
-
Cell definition choice in Query Designer is inactive
In the Query Designer the choice "Define cells" is inactive, or grayed out. Why is this? Is there a global setting or does it have something to do with the query itself?
-
CHaRM 2 system landscape possible??
Hi Solman experts, I have a question. Is CHaRM possible in a 2 system landscape without creating extra clients? For example: BWDEV100 - >DWPRD100 Thanks in advance. Regards, Ricky
-
Does anyone know how to sync the pictures folder between a MacBook Pro and an iMac?
I want to be able to load my pictures onto one computer and have the other one(s) sync with that computer so my pictures are all there on both computers.
-
Is there any alternative application to the Carbid...
Hi, Is there any alternative application to the Carbide.ui Theme Edition? Solved! Go to Solution.