I am using weblogic server.
The following lines of code is what i am using in a
jsp,
-------------------------In jsp -----------------------
javax.naming.Context ctx = null;
Hashtable ht = new Hashtable();
ht.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(javax.naming.Context.PROVIDER_URL,
"t3://localhost:7001");
ctx = new javax.naming.InitialContext(ht);
EtsBean bean = (EtsBean)ctx.lookup("ejb/EtsHome");
to retrieve the context name
my deployment descriptors contains the following....
-------------------------In ejb-jar.xml -----------------------
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN'
'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<!-- A minimal session
EJB deployment -->
<session>
<ejb-name>EtsHome</ejb-name>
<jndi-name>ejb/EtsHome</jndi-name>
<home>EdenBaseBean.etsEJB.EtsHome</home>
<remote>EdenBaseBean.etsEJB.Ets</remote>
<ejb-class>EdenBaseBean.etsEJB.EtsBean</ejb-class>
<!-- or Stateless -->
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<!-- Assembly Descriptor -->
<assembly-descriptor></assembly-descriptor>
</ejb-jar>
-------------------In weblogic-ejb-jar.xml ----------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN" "http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd">
<weblogic-ejb-jar>
<description>Stateful Session Bean Example</description>
<weblogic-enterprise-bean>
<ejb-name>EtsHome</ejb-name>
<stateful-session-descriptor></stateful-session-descriptor>
<reference-descriptor></reference-descriptor>
<jndi-name>ejb/EtsHome</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
This is the following error i am getting on the console,
-----------------------Error Trace ---------------------------
javax.naming.NameNotFoundException: While trying to lookup 'ejb.EtsHome' didn't find subcontext 'ejb' Resolved ; remaining name 'ejb/EtsHome'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:897)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:225)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:154)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:188)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:256)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:357)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at jsp_servlet.__selectestimatesfield._jspService(__selectestimatesfield.java:2068)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:996)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6452)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3661)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2630)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
--------------------------------------------------
Can anyone help me out in resolving this problem.....
Thanks in advance for your kind help...