• Post Reply Bookmark Topic Watch Topic
  • New Topic

TransactionException: could not register synchronization with JTA TransactionManager

 
sai kinnera
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I got this exception 'org.hiberntae.TransactionException: could not register synchronization with JTA TransactionManager' when I tried to persist a collection using hibernate3. The hibernate properties and test class code are:

HIBERNATE CODE :

config=new Configuration().addResource("test.Address.hbm.xml").addResource("test.Person.hbm.xml");
config.setProperties(data.getHibernateProperties());
sessionFactory=config.buildSessionFactory();
session=sessionFactory.openSession();

tx=session.beginTransaction();
session.save(data.getAddressObject());
//getAddressObject() has all the code to populate Address object along with a list of Person objects in it.
tx.commit();
session.flush();

HIBERNATE PROPERTIES: getHibernateProperties() method:
Properties prop=new Properties();
prop.setProperty("hibernate.dialect","OracleDialect");
prop.setProperty("hibernate.transaction.manager_lookup_class","org.hibernate.transaction.WeblogicTransactionManagerLookup");
prop.setProperty("hibernate.transaction.factory_class","org.hibernate.transaction.JTATransactionFactory");
prop.setProperty("jta.UserTransaction","javax.transaction.UserTransaction");
prop.setProperty("hibernate.cache.use_query_cache","false");
prop.setProperty("show_sql","true");
prop.setProperty("hibernate.connection.provider_class","org.hibernate.connection.DatasourceConnectionProvider");
prop.setProperty("query.substitutions","true 1, false 0, yes 'Y', no 'N'");
prop.setProperty("hibernate.connection.datasource","DataSource1");
prop.setProperty("hibernate.jndi.class","weblogic.jndi.WLInitialContextFactory");
prop.setProperty("hibernate.jndi.url","t3://localhost:7001");

What do we synchronize?

Thanks in advance,
Sai
 
Debu Panda
author
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not a Hibernate expert. But try setting another property hibernate.current_session_context_class to jta

-Debu
 
sai kinnera
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried this Debu and it did not work. Still getting the same exception.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!