users@glassfish.java.net

Re: Lookup fails for Local Stateless Bean from web client in Glassfish V2.2

From: <glassfish_at_javadesktop.org>
Date: Sat, 25 Sep 2010 19:22:41 PDT

To access MyStatelessBeanLocal, the client needs to be in the same EAR or WAR as the EJB.

To look up with java:comp/env/MyStatelessBean from web components, you need to either declare a ejb-local-ref whose ejb-ref-name is MyStatelessBean in web.xml, or use @EJB(name="MyStatelessBean") to inject it. Note the name attribute is also what you have in java:comp/env/ lookup name. But if you already inject it, most cases you don't need to look it up.

Or you can look up directly by the bean's portable global jndi name, in the form of java:global/<application-name>/<module-name>/<ejb-name>. For ex: java:global/MyEAR/MyEJBs/MyStatelessBean
[Message sent by forum member 'cf126330']

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