users@glassfish.java.net

Re: jndi failure NameNotFoundException for local interface lookup

From: <glassfish_at_javadesktop.org>
Date: Tue, 26 Feb 2008 05:25:03 PST

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

You access an EJB through its remote interface using the JNDI name, but you access an EJB through its local interface through an ejb-link. There are many tags, annotations and combinations, its easy to pick a wrong one.

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

It does not matter where you store your POJOs. All that's important is what Java EE component you call them from. In your case its a JSP, so please check you have an <ejb-link> definition in the <ejb-local-ref> definition in the web.xml of that JSP.
Your POJO will have lookup code such as the following:

[i] InitialContext ic = new InitialContext();
  FooLocal foo = (FooLocal) ic.lookup("java:comp/env/FooEJB");[/i]

where "FooEJB" is what you wrote in the <ejb-ref-name> tag of your <ejb-local-ref> definition.
Also note that the EJB-JAR and WAR need to be bundled in the same EAR.

Another (non-portable) way to prevent serialization costs is to set <pass-by-reference> to true in sun-application.xml.
[Message sent by forum member 'dkoper' (dkoper)]

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