Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

stackoverflow JTATransactionFactory

Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using hibernate(3.3.1.GA) and tomcat (6.0.18), I am getting Stackoverflow exception, I have googled but could not found the fix.

This is my hibernate config file:

<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/xxxx</property>
<property name="hibernate.connection.username">xxxx</property>
<property name="hibernate.connection.password">xxxx</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.current_session_context_class">jta</property>
<property name="jta.UserTransaction">java:comp/UserTransaction</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JOTMTransactionManagerLookup</property>
<property name="hibernate.current_session_context_class">thread</property>

This is exception I am getting:

java.lang.StackOverflowError Method)
com.sun.naming.internal.VersionHelper12.getContextClassLoader(Unknown Source)
com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
javax.naming.spi.NamingManager.getObjectFactoryFromReference(Unknown Source)
javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
javax.naming.InitialContext.lookup(Unknown Source)

I found recursion in org.hibernate.transaction.JTATransactionFactory method:

protected UserTransaction getUserTransaction() {
log.trace( "Attempting to locate UserTransaction via JNDI [{}]", getUserTransactionName() );

try {
UserTransaction ut = ( UserTransaction ) getInitialContext().lookup( getUserTransactionName() );
if ( ut == null ) {
throw new TransactionException( "Naming service lookup for UserTransaction returned null [" + getUserTransactionName() +"]" );

log.trace( "Obtained UserTransaction" );

return ut;
catch ( NamingException ne ) {
throw new TransactionException( "Could not find UserTransaction in JNDI [" + getUserTransaction() + "]", ne );

Yasir Qureshi
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No one experienced this issues ever before?
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic