org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
While setting up a simple web app on JBoss 5 using container manager transaction I run into following exception
Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:361) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
Well after some research I figured out that the cause of this were two simple configuration options in persistence.xml
First we need to make sure we are using JTA as transaction-type (by default)
<persistence-unit name="PU_NScaffold" transaction-type="JTA">
Second make sure we have following line under properties node
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
Thats it, I hope this helps someone.
February 26th, 2010 at 7:41 am
I used this tip with GlassFish v3 bundle with Netbeans and changed hibernate.transaction.manager_lookup_class value to org.hibernate.transaction.SunONETransactionManagerLookup. Problem solved! Thanks!
March 13th, 2010 at 11:11 am
Thanks Greg, it works for me too
March 17th, 2010 at 9:23 pm
I’m happy that this is useful to some people.
May 22nd, 2010 at 7:18 pm
Thanks Greg and essnet, it works on glassfish v3 for me too.
May 31st, 2010 at 2:46 pm
Thanks also (on glassfish v3). I’m doing the tutorial for Wicket+JPA but now have another Hibernate problem: The CustomerJpaController.getCustomerCount() causes an exception—
java.lang.AbstractMethodError:
org.hibernate.ejb.EntityManagerImpl.getCriteriaBuilder()Ljavax/persistence/criteria/CriteriaBuilder;
Strangely enough, my first build used EclipseLink and encountered the same problem (so I rebuilt with Hibernate)
Running with JDk1.5, NB 6.8, and glassfish V3. Will provide glassfish log if needed.
Any thoughts?
July 21st, 2010 at 12:05 pm
Robert, I have the same problem. Did you manage to find a solution for it?
August 18th, 2010 at 5:58 am
Thanks Greg…. It helped a lottttttttttttttt