users@glassfish.java.net

jndi failure NameNotFoundException for local interface lookup

From: <glassfish_at_javadesktop.org>
Date: Tue, 26 Feb 2008 04:56:10 PST

I setup my first Glassfish EJB3 test session and entity beans. I used the @Stateless, @Local, @Remote, and @Entity annotations and noticed that my web application could easily access the Remote interface to operate on these 2 beans successfully.

But of course, the Remote interface is a useless (Serialization costs) to me since the web app and ejb container are in the same JVM (prolly 99% of the time for the community at large). When I simply replaced the jndi lookup with "localClass.getName()" instead of "remoteClass.getName()" the trouble began... I got the NameNotFoundException on the correct local class name supplied.

The organization of the application is such that a JSP calls a POJO which then calls another POJO who performs the jndi lookup. None of these 3 levels of code contain any annotations and I have NO other ejb bean specific setup in XMLs. Though I have tried using the <ejb-local-ref> construct in web.xml based on the FAQ with NO luck. Do note, the POJO classes above are contained in the ejb module, not the web module.

I have 2 questions:

1 - Why would the Remote work and NOT the Local if they are setup the same?

2 - What is the correct setup for a nested POJO reference, such as this, to access the Local interface?

Many Thanks,
James

PS - Sure wish Glassfish would short-circuit Remotes to Locals automatically when the target bean indeed shares the same JVM as the app - like JBoss does...
[Message sent by forum member 'jameshr' (jameshr)]

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