Hi,

I am getting following error while i am trying to lookup ejb.


Could not dereference object [Root exception is 
javax.naming.NameNotFoundException: ejb not bound]


I am using following code for lookup in a Sevlet.
anonymous wrote : try {
  | Context context = new InitialContext();
  |                     
  | Object ref = context.lookup("java:/comp/env/ejb/MapSession");
  | home = (MapSessionHome) PortableRemoteObject.narrow(ref, 
MapSessionHome.class);
  | } catch (Exception e) {
  | e.printStackTrace();
  | throw new ServletException("look up of java:/comp/env/ejb/MapSession 
failed",e);
  | }

Following is ejb-jar.xml.

anonymous wrote : 
  | <enterprise-beans>
  | 
  | <!-- Session Beans -->
  | 
  |  <![CDATA[Description for MapSession]]>
  |  <display-name>Name for MapSession</display-name>
  | 
  |  <ejb-name>MapSession</ejb-name>
  | 
  |  com.virtualcityindia.ejbs.MapSessionHome
  |  com.virtualcityindia.ejbs.MapSession
  |  <ejb-class>com.virtualcityindia.ejbs.MapSessionSession</ejb-class>
  |  <session-type>Stateless</session-type>
  |  <transaction-type>Container</transaction-type>
  | 
  | 
  | 
  | </enterprise-beans>
  | 

Following is the jboss.xml file:

anonymous wrote : 
  | 
  | 
  |    <enterprise-beans>
  | 
  |      <!--
  |        To add beans that you have deployment descriptor info for, add
  |        a file to your XDoclet merge directory called jboss-beans.xml that 
contains
  |        the ,  and <message-driven></message-driven>
  |        markup for those beans.
  |      -->
  | 
  |       
  |          <ejb-name>MapSession</ejb-name>
  |          
  |                     <jndi-name>ejb/MapSession</jndi-name>
  |              
  |       
  | 
  |     <!--
  |       write a merge file jboss-webservices.ent for webservice-description 
  |     -->
  | 
  |    </enterprise-beans>
  | 
  |    <resource-managers>
  |    </resource-managers>
  | 
  |   <!--
  |     | for container settings, you can merge in jboss-container.xml
  |     | this can contain <invoker-proxy-bindings/> and 
<container-configurations/>
  |   -->
  | 
  | 
  | 

Following is the jboss-web.xml file:
anonymous wrote : 
  | <?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN" 
"http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd";>
  | 
  | <jboss-web>
  | 
  |    <!-- Resource Environment References -->
  |    <!--
  |      For additional resouce-env-ref tags add a merge file called 
jbossweb-resource-env-ref.xml
  |    -->
  | 
  |    <!-- Resource references -->
  |    <!--
  |      For additional resouce-ref tags add a merge file called 
jbossweb-resource-ref.xml
  |    -->
  | 
  |    <!-- EJB References -->
  |    <!--
  |      For additional ejb-ref tags add a merge file called 
jbossweb-ejb-ref.xml
  |    -->
  |    <ejb-ref>
  |       <ejb-ref-name>ejb/MapSession</ejb-ref-name>
  |       <jndi-name>ejb/MapSession</jndi-name>
  |    </ejb-ref>
  | 
  |   <!-- EJB Local References -->
  | </jboss-web>
  | 

Following the relevenat portion of web.xml file:
anonymous wrote : 
  | <web-app>
  | <ejb-ref >
  |       <![CDATA[Reference to the MapSession EJB]]>
  |       <ejb-ref-name>ejb/MapSession</ejb-ref-name>
  |       <ejb-ref-type>Session</ejb-ref-type>
  |       com.virtualcityindia.interfaces.MapSessionHome
  |       com.virtualcityindia.interfaces.MapSession
  |    </ejb-ref>
  | 
  | </web-app>
  | 

When i deploys the ear file to JBoss server: I get following trace:

anonymous wrote : 
  | 18:32:20,228 INFO  [EARDeployer] Init J2EE application: file:/C:/Program 
Files/jboss-4.0.3SP1/server/default/deploy/virtaualcity.ear
  | 18:32:20,688 INFO  [EjbModule] Deploying MapSession
  | 18:32:20,949 INFO  [ProxyFactory] Bound EJB Home 'MapSession' to jndi 
'MapSession'
  | 18:32:20,949 INFO  [EJBDeployer] Deployed: file:/C:/Program 
Files/jboss-4.0.3SP1/server/default/tmp/deploy/tmp56751virtaualcity.ear-contents/webapp.jar
  | 18:32:21,019 INFO  [TomcatDeployer] deploy, ctxPath=/virtualcity, 
warUrl=.../tmp/deploy/tmp56751virtaualcity.ear-contents/virtualcity-exp.war/
  | 18:32:21,309 INFO  [JBossCacheManager] init(): replicationGranularity_ is 0 
and invaldateSessionPolicy is 2
  | 18:32:21,359 INFO  [JBossCacheManager] Starting JBossManager
  | 18:32:21,470 INFO  [EARDeployer] Started J2EE application: file:/C:/Program 
Files/jboss-4.0.3SP1/server/default/deploy/virtaualcity.ear
  | 

It says that EJB is deployed correctly.
I checked in jmx controller also ... the ejb is deployed correctly.
But still when i try to look up (Using the code i specified in the start) ; i 
gets following error:
anonymous wrote : 
  | description The server encountered an internal error () that prevented it 
from fulfilling this request.
  | 
  | exception :
  | javax.servlet.ServletException: look up of java:/comp/env/ejb/MapSession 
failed
  |     com.virtualcityindia.web.IndexServlet.init(IndexServlet.java:60)
  |     javax.servlet.GenericServlet.init(GenericServlet.java:211)
  |     
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
  |     
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
  |     
org.jboss.web.tomcat.tc5.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:81)
  |     
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
  |     
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  |     
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  |     
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
  |     
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
  |     
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
  |     
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
  |     java.lang.Thread.run(Thread.java:595)
  | 
  | 
  | root cause :
  | javax.naming.NamingException: Could not dereference object [Root exception 
is javax.naming.NameNotFoundException: ejb not bound]
  |     org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1052)
  |     org.jnp.interfaces.NamingContext.lookup(NamingContext.java:685)
  |     org.jnp.interfaces.NamingContext.lookup(NamingContext.java:701)
  |     org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
  |     javax.naming.InitialContext.lookup(InitialContext.java:351)
  |     com.virtualcityindia.web.IndexServlet.init(IndexServlet.java:56)
  |     javax.servlet.GenericServlet.init(GenericServlet.java:211)
  |     
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
  |     
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
  |     
org.jboss.web.tomcat.tc5.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:81)
  |     
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
  |     
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  |     
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  |     
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
  |     
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
  |     
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
  |     
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
  |     java.lang.Thread.run(Thread.java:595)
  | 
  | 
  | root cause :
  | javax.naming.NameNotFoundException: ejb not bound
  |     org.jnp.server.NamingServer.getBinding(NamingServer.java:514)
  |     org.jnp.server.NamingServer.getBinding(NamingServer.java:522)
  |     org.jnp.server.NamingServer.getObject(NamingServer.java:528)
  |     org.jnp.server.NamingServer.lookup(NamingServer.java:252)
  |     org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
  |     org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
  |     javax.naming.InitialContext.lookup(InitialContext.java:351)
  |     org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1046)
  |     org.jnp.interfaces.NamingContext.lookup(NamingContext.java:685)
  |     org.jnp.interfaces.NamingContext.lookup(NamingContext.java:701)
  |     org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
  |     javax.naming.InitialContext.lookup(InitialContext.java:351)
  |     com.virtualcityindia.web.IndexServlet.init(IndexServlet.java:56)
  |     javax.servlet.GenericServlet.init(GenericServlet.java:211)
  |     
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
  |     
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
  |     
org.jboss.web.tomcat.tc5.session.ClusteredSessionValve.invoke(ClusteredSessionValve.java:81)
  |     
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
  |     
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  |     
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  |     
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
  |     
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
  |     
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
  |     
org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
  |     java.lang.Thread.run(Thread.java:595)
  | 
  | 
  | 

Can somebody pleae reply early. I need to solve this problem as quickly as 
possible.

Thanks in advance,
Best Regards,
Ashwani

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3945339#3945339

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3945339


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to