users@jersey.java.net

Re: Cannot use an EntityTransaction while using JTA, cannot switch to application managed transactions

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 10 Apr 2008 11:23:31 +0200

Jakub Podlesak wrote:
>>
>> @Resource
>> private UserTransaction utx;
>
> You are probably right. The utx is not injected (in the above mentioned
> example it is taken directly from jndi in [com.sun.ws.rest.samples.bookmark.util.tx.TransactionManager])
>
> Do we agree, that the issue is that the UserTransaction does not get injected?
>

Yes, the ServletAdapter only supports injection with @PersistenceUnit.
It does not support generic injection of @Resource stuff.

Note that Jersey, on it's own, is not EE compliant, we have not
specified what the EE behavior should be for resource classes, and since
EE will be finalized (current date is Q2 2009) after JAX-RS is finalized
(September 08) we will probably have to do a rev of JAX-RS to specify EE
support.

There might be three solutions:

1) Modify ServletAdapter to support the injection of:

      @Context UserTransaction utx.

2) Modify ServlerAdapter to support @Resource using JNDI lookup; or

3) Use Spring managed beans.

Paul.

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109