users@glassfish.java.net

lookup local slsb from a pojo

From: Tim Kiener <tim.kiener_at_gmx.de>
Date: Tue, 19 May 2009 15:24:25 +0200

hi there,

its really annoying. i just cant get this usecase to work:

#1: i have got a simple POJO
#2: i have got a

        @Local(MyLocal.class)
        @Stateless
        public class MyLocalEJB implements MyLocal{...}

#3 the PJO and the EJB run within the same EJB-Jar(and EAR)

Question:

How can i lookup the local EJB within my POJO.


I tried the following:

#A

InitialContext ic =new InitialContext();
ic.loopkup("java:comp/env/MyLocalEJB");


#B
setting @Stateless(name="MyLocalEJB")

and tried the ic.lookup(...) again


#C
setting @Stateless(name="ejb/MyLocalEJB")

and tried the ic.lookup("java:comp/env/ejb/MyLocalEJB") again



CONCLUSION
nothing worked.

the glassfish-faq is not clear for me. they assume that you want to
lookup a local-ejb from a web-client and therefore
edit the web.xml
thats not what i want.

if anybody knows the solution, please be as clear as you can writing
sample-code.



thanks in advance. and sorry for sounding stressed.
tim