JNDI-problem with Tutorial
chlfromde Jan 23, 2005 11:17 AMI try to run the Fibo-example from 1.30 Tutorial.
(JBoss 4.01, Eclipse 3.01, IDE 1.40, Jdk 1.50, WinXP)
The lookup for the Ejb-Ref in ComputeServlet.Init() raises an exeception:
Context context = new InitialContext();
Object ref = context.lookup("java:/comp/env/ejb/Fibo");
bang!
javax.servlet.ServletException: Could not dereference object
tutorial.web.ComputeServlet.init(ComputeServlet.java:67)
org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:595)
All DD's seem to be fine (see below) and there are no errors during deployment. I modified the code, using
context.list() to browse "java:/comp/env/"; the entry for Fibo is present.
Is this an security-issue, missing rights for the servlet to access the ejb ?
(exceptions namespace: org.jboss.web.tomcat.security.*)
Thanks a lot
Christian
---------------------------------------------------------------------------------------
JBoss.xml:
<ejb-name>Fibo</ejb-name>
<jndi-name>ejb/Fibo</jndi-name>
ejb-jar.xml
<![CDATA[Description for Fibo]]>
<display-name>Name for Fibo</display-name>
<ejb-name>Fibo</ejb-name>
tutorial.interfaces.FiboHome
tutorial.interfaces.Fibo
<ejb-class>tutorial.ejb.FiboBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
jboss-web.xml:
<ejb-ref>
<ejb-ref-name>ejb/Fibo</ejb-ref-name>
<jndi-name>ejb/Fibo</jndi-name>
</ejb-ref>
web.xml:
<ejb-ref >
<![CDATA[Reference to the Fibo EJB]]>
<ejb-ref-name>ejb/Fibo</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
tutorial.interfaces.FiboHome
tutorial.interfaces.Fibo
</ejb-ref>