users@jersey.java.net

Cannot get in-memory test container to inject EJB into a resource class

From: Ian Smith <m4r35n357_at_googlemail.com>
Date: Wed, 13 Oct 2010 10:28:19 +0100

I have a fully working resource class that injects a service via @EJB
and a UriInfo via @Context. When I attempt to test this class using
the in-memory container I get a NPE for the service field. In the
debugger, I can quite clearly see that the uriInfo field is populated,
and the service field is null.

This is against version 1.2 of the framework, but I have observed the
same problem on all later versions from the maven repo that I have
tried up to 1.5-SNAPSHOT.

Would appreciate some feedback, I believe it is a common use case and
simple to reproduce.

Regards,

Ian.