users@glassfish.java.net

Re: EJB Reference from a Helper class in the same EJB module

From: <glassfish_at_javadesktop.org>
Date: Wed, 14 May 2008 08:20:13 PDT

I followed the link to investigate my problem. Well, the FAQ is not clear enough for me. I think my problem is addressed in this part:

[i](...) if the POJO is itself called from an EJB, the local EJB dependency must be defined within that EJB component. Unlike the .war case, the component environment (java:comp/env) is scoped at the bean level for EJBs.

@EJB(name="fooejbref", beanInterface=FooLocal.class)
@Stateless
public class BarBean implements BarLocal { ...[/i]

Where is the POJO? Is BarBean a POJO? It seems to be a stateless session bean, right? FooBean is also a session bean. I concluded that we can use the same JNDI name (in my case "java:comp/env/DiaUtilBsn") for a web application and for a utility class in the EJB module. I'm doing that, but it doesn't work. The mentioned error ocurrs. Is it necessary to transform my utility class in an EJB? Unfortunately, I can't do that. :-(

Yes. I agree that JBoss uses a very strange JNDI syntax. Actually, I developed a service locator logic to identify what server the application is running an use the correct JNDI syntax. So, the application runs fine in JBoss using <App-name>/DiaUtilBsn/local but it doesn't run at all in Glassfish using "java:comp/env/DiaUtilBsn". I didn't realize what should I do to improve the portability of my application.
[Message sent by forum member 'hbeto' (hbeto)]

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