users@glassfish.java.net

EJB lookup from POJO

From: <glassfish_at_javadesktop.org>
Date: Tue, 29 Jul 2008 06:10:25 PDT

Hello,

i have a application bundled as ear file. The ear file contains different EJBs and servlets. One of the servlets uses same POJOs. One of the POJOs tries to lookup the local interface of an EJB.

Following https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB I've added the following entries to web.xml:
    <ejb-local-ref>
        <ejb-ref-name>SomeManagerBean</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <local-home/>
        <local>foo.bar.SomeManagerLocal</local>
    </ejb-local-ref>

To lookup the local interface i use something like
context.lookup( "java:comp/env/SomeManagerBean" );

The look fails throwing the following exception:
javax.naming.NamingException: invocation exception
        at com.sun.enterprise.naming.NamingManagerImpl.getComponentId(NamingManagerImpl.java:1332)
        at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:827)
        at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:173)
        at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:396)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)

Same setup works for some other EJBs and i do not have a clue why it doesn't work here. Any idea whats going wrong in this case?


Cheers,
Christian
[Message sent by forum member 'cplaetzinger' (cplaetzinger)]

http://forums.java.net/jive/thread.jspa?messageID=290059