users@glassfish.java.net

java:app question

From: Laird Nelson <ljnelson_at_gmail.com>
Date: Sat, 1 Feb 2014 13:07:45 -0800

(I erroneously sent this to a prior incarnation of the users list; my
apologies if it gets forwarded and comes through twice.)

The Java EE 6 tutorial says that:

java:app/SomeUniqueAcrossTheEarBeanName

...should work from another EJB somewhere in the same .ear file, but the
EJB spec says that the module name containing the bean is required.

The EJB FAQ (https://glassfish.java.net/javaee5/ejb/EJB_FAQ.html) also says
that it won't work—that you need to do:

java:app/*some-ejb-module-name/*SomeUniqueAcrossTheEarBeanName

We're seeing that without the module name in java:app names that indeed the
lookup doesn't happen. This is in Glassfish 3.1.2.2.

Is there any way, armed with just a business interface and a bean name, to
look the bean up in an .ear file from another bean in the .ear file? Can I
programmatically find a list of module names?

I tried to work around this with a custom CDI extension, but that resulted
in NullPointerExceptions from deep within Weld somewhere during embedded
GlassFish testing, and also requires the EJB jars to be bean archives,
which I would like to avoid if possible. I'll detail the errors
encountered if there's interest.

Best,
Laird

-- 
http://about.me/lairdnelson