[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3438?page=c...
]
Daniel Freitas commented on HHH-3438:
-------------------------------------
I resolved the StackOverflow issue with JOTM/Jetty running embedded.
Hibernate version: 3.3.1.GA
Jotm version: 2.0.10
Jetty version: 6.1.11
After reading the source code for the method
"org.hibernate.transaction.JTATransactionFactory.resolveUserTransactionName(Properties
properties)" I could see it tries to find under which name the UserTransaction class
is bound in jndi. It does so by checking the property "jta.UserTransaction" from
the provided properties file. Failing that, it defaults to the TransactionManagerLookup
class, which in my case was the JOTMTransactionManagerLookup, and queries for the user
transaction name by calling JOTMTransactionManagerLookup.getUserTransactionName(), which
in turn returns "java:comp/UserTransaction".
When hibernate then tries to load this object from JNDI, a NamingException in thrown but
the catch clause in JTATransactionFactory.getUserTransaction() build an error message by
calling getUserTransaction() again, thus causing the StackOverflow.
To solve this issue in my particular case, I have two options:
1 - Add the property jta.UserTransaction=UserTransaction (I did this by adding a java
property with -D) or
2 - Register the Jotm UserTransaction class under "java:comp/UserTransaction"
instead of only "UserTransaction" eg.: new
org.mortbay.jetty.plus.naming.Resource("java:comp/UserTransaction");
I hope it might help.
Could not check JTA transaction; nested exception is
java.lang.StackOverflowError
---------------------------------------------------------------------------------
Key: HHH-3438
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3438
Project: Hibernate Core
Issue Type: Bug
Components: core
Affects Versions: 3.3.0.GA
Reporter: Jara Cesnek
This code cause infinite loop. Moreover still dont work with JOTM. HHH-3358
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 );
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira