users@glassfish.java.net

Re: lookup local slsb from a pojo

From: Tim Kiener <tim.kiener_at_gmx.de>
Date: Tue, 19 May 2009 19:28:53 +0200

hi andreas,

thanks for your answer.
your CoreFacadeBean is a POJO(as long as slsb are POJOs), but its a
managed POJO.

My POJO , from where i need to do the lookup, is a spring-managed-
bean, invoked by an external jcr-event(jackrabbit).
but anyway, the whole application is deployed within a single EAR,
without any web-modules.

so your answer is not exactly what i was after, but thanks for your
help.

tim

p.s. i read the glassfish v3 prelude docs and found an issue to map
local-ejbs the the jndi-tree.
so maybe v2.1 simply does not support a lookup from a non-managed POJO.




Am 19.05.2009 um 17:10 schrieb glassfish_at_javadesktop.org:

> Tim,
>
> we had exactly the same problem and the EJB_FAQ is *NOT* clear about
> this, I agree. Finally we figured it out, thanks to this link: http://openejb.apache.org/3.0/ejb-local-ref.html
>
>
> You need to put the @EJB annotation with name and class of the local
> interface that you are trying to lookup on top of the SessionBean
> that does the lookup. In JBoss there was no need for this, but here
> there is (I'm not sure why, as it seems to be redundant boiler-plate
> code).
>
> Example:
>
> SessionBean being looked up:
>
> @Stateless
> public class CoreBean implements CoreLocal {
> ....
>
>
>
> SessionBean doing the lookup:
>
> @Stateless
> @EJB(name = "myFooEjb", beanInterface = CoreLocal.class)
> public class CoreFacadeBean implements CoreFacade {
>
>
> public void someMethod() {
> CoreLocal coreBean = (CoreLocal) ctx.lookup("myFooEjb");
> ...
> }
>
>
> I hope this is clear enough. If not, let me know.
>
> - Andreas
> [Message sent by forum member 'ansis' (ansis)]
>
> http://forums.java.net/jive/thread.jspa?messageID=346798
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net