users@glassfish.java.net

Re: JAX-RS on Glassfish 3.1: _at_EJB injection?

From: <glassfish_at_javadesktop.org>
Date: Tue, 15 Jun 2010 14:12:58 PDT

OK, almost there.

I have an ear with the following structure for which dependency injection is still not working:

ear/lib/jar-containing-resources.jar
ear/lib/jar-containing-resources.jar/META-INF/beans.xml
ear/ejb-jar.jar
ear/war-file.war

My resource class is in the jar-contianing-resources.jar. Note that I have placed an empty beans.xml file in that jar file's META-INF directory, per the CDI specification.

I am "publishing" my application according to section 2.3 of the JAX-RS 1.1 specification. That is, I have an empty Application subclass annotated with @ApplicationPath and no web.xml file.

The result is that--nicely!--I can confirm that resource classes need not be in a web application; they can indeed be in the lib directory of an ear. My application is published, and "answers the phone" as I would expect.

However, my @RequestScoped resource, which contains an @EJB-annotated field, does not have that field injected.

Did I put my beans.xml in the wrong place? Am I missing anything else obvious? If not, I will happily attach my test project to this thread.

Best,
Laird
[Message sent by forum member 'ljnelson']

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