Apache Geronimo > Discussion Forums  User List | Dev List | Wiki | Issue Tracker  

 « Return to Thread: JNDI Name for EJB3

Re: JNDI Name for EJB3

by Juergen Weber :: Rate this Message:

Reply to Author | View in Thread

OK, I got it to run with <ejb-local-ref> using the sample from
http://cwiki.apache.org/GMOxDOC20/very-simple-session-ejb-example.html

(which does contain a web.xml)

        <ejb-local-ref>
                <ejb-ref-name>ejb/Secured3</ejb-ref-name>
                <ejb-ref-type>Session</ejb-ref-type>
                <local>ejb3.Secured3</local>
        </ejb-local-ref>

context = new InitialContext();
Secured3 secured3 = (Secured3) context.lookup("java:comp/env/ejb/Secured3");

I also needed a sys:dependency from geronimo-web.xml to openejb-jar.xml to make the remote interface known to the JSP (this is missing in the above sample).
First I simply included the ejb.jar into WEB-INF/lib, but this results in ClassCastException on JNDI lookup (I guess because the Remote interface in JNDI is from a different (the ejb) classloader than the cast target which is from the web application).

Thanks,
Juergen

 « Return to Thread: JNDI Name for EJB3