• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB Lookup Problem

 
Praveena Chordia
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I am using RAD v6 and webSphere
I have created one Servlet and using an EJB in that servlet .

in web.xml file

<ejb-ref>
<description>
</description>
<ejb-ref-name>SimpleSessionRef</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.webage.ejbs.SimpleSessionHome</home>
<remote>com.webage.ejbs.SimpleSession</remote>
<ejb-link>Test_EJB.jar#SimpleSession</ejb-link>
</ejb-ref>

in servlet code i am using following code for getting its reference

Context ctx = new InitialContext();
Object o = ctx.lookup("java:comp/env/SimpleSessionRef");


but at point Object o = ctx.lookup("java:comp/env/SimpleSessionRef");
I am getting following exception when servlet runs
javax.naming.NameNotFoundException: Name "comp/env/SimpleSessionRef" not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1074)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:985)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1263)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:198)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:139)
at javax.naming.InitialContext.lookup(InitialContext.java:361)
at com.webpage.servlets.SquareRootServlet.doGet(SquareRootServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1212)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:629)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2837)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:220)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:204)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1681)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:77)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:421)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:367)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:201)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:103)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:548)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:601)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:934)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1021)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1332)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!