[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2160) JTATransactionFactory.isTransactionInProgress fails with WebSphereExtendedJTATransactionLookup

Timothy Folks (JIRA) noreply at atlassian.com
Wed Oct 18 10:45:24 EDT 2006


JTATransactionFactory.isTransactionInProgress fails with WebSphereExtendedJTATransactionLookup
----------------------------------------------------------------------------------------------

         Key: HHH-2160
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2160
     Project: Hibernate3
        Type: Bug

  Components: core  
    Versions: 3.2.0.ga    
 Environment: Hibernate 3.2.0 ga
WebSphere Application Server 6.0.2.15
DB2 9.1
    Reporter: Timothy Folks


Configurating Hibernate with the following settings:

hibernate.transaction.factory_class=org.hibernate.transaction.JTATransactionFactory
hibernate.transaction.manager_lookup_class=org.hibernate.transaction.WebSphereExtendedJTATransactionLookup
jta.UserTransaction=java:comp/UserTransaction
hibernate.current_session_context_class=jta

results in the following stack trace (irrelevant lines snipped)

<snipped>
Caused by: org.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
	at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:181)
	at org.hibernate.jdbc.JDBCContext.<init>(JDBCContext.java:76)
	at org.hibernate.impl.SessionImpl.<init>(SessionImpl.java:213)
	at org.hibernate.impl.SessionFactoryImpl.openSession(SessionFactoryImpl.java:525)
	at org.hibernate.context.JTASessionContext.buildOrObtainSession(JTASessionContext.java:114)
	at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:80)
	at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542)
<snipped>
Caused by: java.lang.UnsupportedOperationException
	at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter.getStatus(WebSphereExtendedJTATransactionLookup.java:78)
	at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:94)
	at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:187)
	at org.hibernate.jdbc.JDBCContext.registerSynchronizationIfPossible(JDBCContext.java:159)

The workaround I've implemented is to change the following line in JTATransactionFactory.isTransactionInProgress:

if ( jdbcContext.getFactory().getTransactionManager() != null ) {

to:

if ( jdbcContext.getFactory().getTransactionManager() != null && jdbcContext.getFactory().getTransactionManager() instanceof WebSphereExtendedJTATransactionLookup.TransactionManagerAdapter == false) { 

This results in the method falling back to looking up the UserTransaction in JNDI and calling getStatus on that.

-- 
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.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list