I have an EJB packaged in an .ear
file.
This EJB needs to look up a reference to another EJB packaged in a different .jar
file in the same .ear
file.
The calling EJB does not know what module the target EJB lives in.
From reading the Java EE specification, this seems like exactly what the java:app
namespace is for. I would think that I'm allowed to do this:
final Frobnicator f = (Frobnicator)context.lookup("java:app/FrobnicatorBean");
...but in GlassFish 3.1.2.2 that bean name is not found.
I can see the bean is deployed successfully and gets a global JNDI name assigned to it just fine, so it exists, and the bean name (FrobnicatorBean
) above is correct.
Am I misreading the specification? Must I actually specify the module name as well? If so, what good is the java:app
namespace?
Must I actually specify the module name as well? If so, what good is the java:app namespace?
According to ejb 3.1 specification :
4.4 Global JNDI Access ->4.4.1.1 java:app
The java:app prefix allows a component executing within a Java EE application to access an application-specific namespace.
The resulting syntax is :
java:app/<module-name>/<bean-name>[!<fully-qualified-interface-name>]</html>
Note that <module-name> is a required part of the syntax...