*
The moose likes EJB and other Java EE Technologies and the fly likes Injecting @Resource UserTransaction results in null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Injecting @Resource UserTransaction results in null" Watch "Injecting @Resource UserTransaction results in null" New topic
Author

Injecting @Resource UserTransaction results in null

B Nirvan
Ranch Hand

Joined: Oct 20, 2010
Posts: 82
I am trying to use JTA transactions (without EJB) in my JPA project. I am trying to inject UserTransaction using the following code in one of my java class


but nothing gets injected and the tran variable is null. Am I missing out any configuration steps. I am using Glassfish V3.

regards,
Nirvan.
Tim Hagberg
Greenhorn

Joined: Jan 29, 2010
Posts: 12
They need to be on the same line like this:
B Nirvan
Ranch Hand

Joined: Oct 20, 2010
Posts: 82
Thanks, but that doesn't work either.

regards,
Nirvan
B Nirvan
Ranch Hand

Joined: Oct 20, 2010
Posts: 82
Is it possible to inject @Resource UserTransaction into a non-managed object (object created with new).

regards,
Nirvan.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Injecting @Resource UserTransaction results in null
 
Similar Threads
java.lang.ClassCastException:
UserTransaction in Hibernate
Getting NotSupportedException while Transaction.begin.
Use of UserTransaction
not able to insert data in db using jpa(hibernate as provider) and jboss AS