users@glassfish.java.net

Re: lookup ejbs

From: <glassfish_at_javadesktop.org>
Date: Thu, 16 Oct 2008 07:46:00 PDT

> Firstly, I use Spring, so I shouldn't need to use the
> @EJB annotation in the web tier. Logically, I just
> give it the good jndi name:
> <jee:local-slsb
> id="personManager"
> jndi-name="java:comp/env/personManagerBean"
>
> usiness-interface="app.ejb.session.PersonManagerLocal"

I have no idea what Spring does under the covers, but in Java EE
the only way an environment dependency (something in java:comp/env/)
can be defined is by an environment annotation (@EJB, @Resource, etc.)
or via a standard deployment descriptor.

>
> />
> tte fact that I can't access the EJB isn't a problem
> from Spring. I have already done this with glassfish
> and Spring, without problem (and I have tried to use
> the lookup method, with exactly the same error than
> with Spring)
>
> Secondly, in my knowledge, it is possible to define
> the jndi name (behind "java:comp/env" in the EJB
> tier, and I thunk that it was with the annotations
> @Stateless(name="", mappedName="") and
> @Statefull(name="", mappedName="").

@Stateless name() and
mappedName() serve different purposes. mappedName()
is not portable and doesn't apply to local interfaces.
@Stateless name() is not the same thing as the string you
pass into a *client*-side lookup.

>
> And fially (but it is not really the problem here),
> with glassfish, I think that you can simply use the
> @EJB annotation with a simple attribute to use it
> directly as an ejb (but one more time it is not what
> I am looking for actually, and it is not generic).
>
> I hope my language is understandable, tell me if I am
> not clear.

Here are a couple EJB FAQ entries that might help clarify :

https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#POJOLocalEJB
https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#EJB_ejb-ref_ejb_local_ref

>
>
> I would be really really happy to find the solution
> to this strange problem. I am almost sure that the
> solution is very simple, but I can't find it.
>
> Thank you for your help.
[Message sent by forum member 'ksak' (ksak)]

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