users@jersey.java.net

Re: [Jersey] Inject EJB into resource class

From: Zach Cox <zcox522_at_gmail.com>
Date: Thu, 27 Aug 2009 10:36:30 -0400

I take that back - it's not working fine. My stateless session
bean/resource class has this injected field:

        @PersistenceContext(unitName = "myPU")
        private EntityManager manager;

This EntityManager gets injected when my bean is injected into a JSF
managed bean, but it does not get injected when my bean is used as a
Jersey resource. Is this why GlassFish v3 Preview is required?


On Thu, Aug 27, 2009 at 10:20 AM, Zach Cox<zcox522_at_gmail.com> wrote:
> Hi Paul,
>
>> 2) Make PicturesResource a stateless or singleton bean and resource. You
>> need to use a version of GlassFish that is equal to or greater than preview.
>
> I really like this approach: by adding JAX-RS annotations to a
> stateless session bean you end up being able to reuse your business
> logic by 1) injecting that bean into other things like a JSF managed
> bean, and 2) exposing it as a RESTful web service.
>
> I'm using the latest GlassFish Tools Bundle for Eclipse v1.1 that
> includes a bundled GlassFish v3 Prelude, and everything seems to be
> working fine.  Is there something specifically in GlassFish v3 Preview
> I should be aware of, that's not in Prelude?
>
> Thanks,
> Zach
>