Skip to main content

TransactionManagerHelper.getTransaction() returns null

1 reply [Last post]
fericit_bostan
Offline
Joined: 2010-06-09

I'm using GlassFish v3 with Spring 2.5 and Hibernate. I have Spring managing my transactions for me but using the Platform Transaction Manager. My configuration is as follows:

jdbc/myDataSource

.... mappings

org.hibernate.transaction.JTATransactionFactory
org.hibernate.dialect.SQLServerDialect
jta
org.hibernate.transaction.SunONETransactionManagerLookup
java:comp/TransactionSynchronizationRegistry
false
com.intraxinc.common.da.dao.OSCacheProvider
true
true
true
true

My problem is that the transaction is not getting started. In the Spring class, org.springframework.orm.hibernate3.SessionFactoryUtils line 448, a call is made to the jtaTm.getTransaction(), jtaTm is an instance of com.sun.enterprise.transaction.TransactionManagerHelper. This method returns a null so no transaction is started. Why? Do I have something configured incorrectly or do I need to enable something in GlassFish to make the TransactionManager return to me a new Transaction?

Thanks for the help...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fericit_bostan
Offline
Joined: 2010-06-09

I found the issue. It's all due to this bug:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=12133

Because the container was ignoring the annotations other than @WebService the class was never exposed as an EJB and none of the transaction management was handled by the container. While I did annotate the class with Spring's @Transactional annotation, it simply doesn't help because the instance of the class that Spring is managing is difference from the instance that GlassFish is maintaining. So the Spring Transaction management would never kick i because the instance invoked was not the one Spring was managing.