users@jersey.java.net

Re: [Jersey] Cannot get in-memory test container to inject EJB into a resource class

From: Paul Sandoz <Paul.Sandoz_at_ORACLE.COM>
Date: Fri, 15 Oct 2010 09:48:18 +0200

Hi Ian,

The in-memory test container does not support an EJB container nor EE
injection, nor does it support a Web container, it is just a very
simple way to test certain types of resource classes.

To do what you require you need to use the external container support
with deployment to GlassFish.

Paul.


On Oct 13, 2010, at 11:28 AM, Ian Smith wrote:

> 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.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>