Hi,
I'm working with WS 5.0 and JTA, an MDB and an MQ queue.
I'm getting a can't register transaction synchronization when trying to process a message from the queue.
my Datasource and Queue are XA resources.
Can someone help?
Included are the stack traces, version info, and configuration files of my app.
Could someone also post an example of what properties I should configure in order to use the 2.1.8 WebSphereExtendedJTATransactionLookup class?
Thanks,
-Ben
Hibernate version:
I tried both 2.1.7 and 2.1.8
Hibernate.properties:
#jta.UserTransaction=java:comp/UserTransaction
#jta.UserTransaction=java:UserTransaction
#jta.UserTransaction=puma:jta/usertransaction
#jta.UserTransaction=java:/comp/UserTransaction
jta.UserTransaction=java:comp/websphere/ExtendedJTATransaction
hibernate.transaction.manager_lookup_class = net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
#hibernate.transaction.manager_lookup_class = net.sf.hibernate.transaction.WebSphereExtendedJTATransactionLookup
hibernate.connection.datasource = jdbc/Ora8DevXA
Code between sessionFactory.openSession() and session.close():
list = HibernateUtil.currentSession().find(query, parameters.getValues(), parameters.getTypes());
Full stack trace of any exception that occurs:
net.sf.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3357)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3321)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:66)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:779)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1553)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1530)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1526)
at com.sscims.cdag.util.HibernateQueryHelper.find(HibernateQueryHelper.java:65)
at com.sscims.cdag.dao.BaseDAO.findUnique(BaseDAO.java:42)
at com.sscims.cdag.dao.DataElementDAO.getDataElement(DataElementDAO.java:41)
at com.sscims.cdag.receptor.TextMessageReader.readMessage(TextMessageReader.java:92)
at com.sscims.cdag.receptor.TextMessageProcessor.process(TextMessageProcessor.java:55)
at com.sscims.cdag.receptor.MessageReceptorBean.onMessage(MessageReceptorBean.java:46)
at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:205)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:194)
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:172)
at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:905)
at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:696)
at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:481)
at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:448)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:90)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:120)
at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:372)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
Caused by:
javax.transaction.RollbackException
at com.ibm.ejs.jts.jta.TransactionImpl.registerSynchronization(TransactionImpl.java:955)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3352)
Name and version of the database you are using:
Oracle 8.1.7
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
[2005-02-04 10:00:31,566] MessageListenerThreadPool : 0 net.sf.hibernate.cfg.SettingsFactory INFO - Use outer join fetching: true
[2005-02-04 10:00:31,566] MessageListenerThreadPool : 0 net.sf.hibernate.util.NamingHelper INFO - JNDI InitialContext properties:{}
[2005-02-04 10:00:32,270] MessageListenerThreadPool : 0 net.sf.hibernate.connection.DatasourceConnectionProvider INFO - Using datasource: jdbc/Ora8DevXA
[2005-02-04 10:00:32,285] MessageListenerThreadPool : 0 net.sf.hibernate.transaction.TransactionFactoryFactory INFO - Transaction strategy: net.sf.hibernate.transaction.JTATransactionFactory
[2005-02-04 10:00:32,285] MessageListenerThreadPool : 0 net.sf.hibernate.util.NamingHelper INFO - JNDI InitialContext properties:{}
[2005-02-04 10:00:32,285] MessageListenerThreadPool : 0 net.sf.hibernate.transaction.TransactionManagerLookupFactory INFO - instantiating TransactionManagerLookup: net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
[2005-02-04 10:00:32,332] MessageListenerThreadPool : 0 net.sf.hibernate.transaction.TransactionManagerLookupFactory INFO - instantiated TransactionManagerLookup
[2005-02-04 10:00:32,332] MessageListenerThreadPool : 0 net.sf.hibernate.transaction.WebSphereTransactionManagerLookup INFO - WebSphere 5.0
[2005-02-04 10:00:32,332] MessageListenerThreadPool : 0 net.sf.hibernate.transaction.TransactionManagerLookupFactory INFO - instantiating TransactionManagerLookup: net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
[2005-02-04 10:00:32,332] MessageListenerThreadPool : 0 net.sf.hibernate.transaction.TransactionManagerLookupFactory INFO - instantiated TransactionManagerLookup
[2005-02-04 10:00:34,020] MessageListenerThreadPool : 0 net.sf.hibernate.cfg.SettingsFactory WARN - Could not obtain connection metadata
java.sql.SQLException: DSRA9002E: ResourceException with error code null: javax.resource.ResourceException: enlist: caught Exception
at com.ibm.ejs.j2c.XATransactionWrapper.enlist(XATransactionWrapper.java:699)
at com.ibm.ejs.j2c.ConnectionEventListener.interactionPending(ConnectionEventListener.java:696)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processInteractionPendingEvent(WSRdbManagedConnectionImpl.java:1132)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.beginTransactionIfNecessary(WSJdbcConnection.java:429)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.getMetaData(WSJdbcConnection.java:1042)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:86)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1160)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:794)
at com.sscims.cdag.util.HibernateUtil.setSessionFactory(HibernateUtil.java:57)
at com.sscims.cdag.util.HibernateUtil.getSessionFactory(HibernateUtil.java:106)
at com.sscims.cdag.util.ThreadLocalSession.currentSession(ThreadLocalSession.java:59)
at com.sscims.cdag.util.HibernateUtil.currentSession(HibernateUtil.java:171)
at com.sscims.cdag.receptor.TextMessageReader.readMessage(TextMessageReader.java:81)
at com.sscims.cdag.receptor.TextMessageProcessor.process(TextMessageProcessor.java:55)
at com.sscims.cdag.receptor.MessageReceptorBean.onMessage(MessageReceptorBean.java:46)
at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:205)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:194)
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:172)
at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:905)
at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:696)
at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:481)
at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:448)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:90)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:120)
at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:372)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
-------- chained exception -------
javax.transaction.SystemException: Failed to start the transaction association.
at com.ibm.ejs.jts.jta.TransactionImpl.enlistResource(TransactionImpl.java:757)
at com.ibm.ejs.jts.jta.JTSXA.enlist(JTSXA.java:998)
at com.ibm.ejs.j2c.XATransactionWrapper.enlist(XATransactionWrapper.java:598)
at com.ibm.ejs.j2c.ConnectionEventListener.interactionPending(ConnectionEventListener.java:696)
at com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl.processInteractionPendingEvent(WSRdbManagedConnectionImpl.java:1132)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.beginTransactionIfNecessary(WSJdbcConnection.java:429)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.getMetaData(WSJdbcConnection.java:1042)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:86)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1160)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:794)
at com.sscims.cdag.util.HibernateUtil.setSessionFactory(HibernateUtil.java:57)
at com.sscims.cdag.util.HibernateUtil.getSessionFactory(HibernateUtil.java:106)
at com.sscims.cdag.util.ThreadLocalSession.currentSession(ThreadLocalSession.java:59)
at com.sscims.cdag.util.HibernateUtil.currentSession(HibernateUtil.java:171)
at com.sscims.cdag.receptor.TextMessageReader.readMessage(TextMessageReader.java:81)
at com.sscims.cdag.receptor.TextMessageProcessor.process(TextMessageProcessor.java:55)
at com.sscims.cdag.receptor.MessageReceptorBean.onMessage(MessageReceptorBean.java:46)
at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:205)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:194)
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:172)
at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:905)
at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:696)
at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:481)
at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:448)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:90)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:120)
at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:372)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1019)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.beginTransactionIfNecessary(WSJdbcConnection.java:443)
at com.ibm.ws.rsadapter.jdbc.WSJdbcConnection.getMetaData(WSJdbcConnection.java:1042)
at net.sf.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:86)
at net.sf.hibernate.cfg.Configuration.buildSettings(Configuration.java:1160)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:794)
at com.sscims.cdag.util.HibernateUtil.setSessionFactory(HibernateUtil.java:57)
at com.sscims.cdag.util.HibernateUtil.getSessionFactory(HibernateUtil.java:106)
at com.sscims.cdag.util.ThreadLocalSession.currentSession(ThreadLocalSession.java:59)
at com.sscims.cdag.util.HibernateUtil.currentSession(HibernateUtil.java:171)
at com.sscims.cdag.receptor.TextMessageReader.readMessage(TextMessageReader.java:81)
at com.sscims.cdag.receptor.TextMessageProcessor.process(TextMessageProcessor.java:55)
at com.sscims.cdag.receptor.MessageReceptorBean.onMessage(MessageReceptorBean.java:46)
at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:205)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:194)
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:172)
at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:905)
at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:696)
at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:481)
at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:448)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:90)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:120)
at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:372)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
[2005-02-04 10:00:34,020] MessageListenerThreadPool : 0 net.sf.hibernate.cfg.SettingsFactory INFO - Use scrollable result sets: false
[2005-02-04 10:00:34,020] MessageListenerThreadPool : 0 net.sf.hibernate.cfg.SettingsFactory INFO - Use JDBC3 getGeneratedKeys(): false
[2005-02-04 10:00:34,020] MessageListenerThreadPool : 0 net.sf.hibernate.cfg.SettingsFactory INFO - Optimize cache for minimal puts: false
[2005-02-04 10:00:34,020] MessageListenerThreadPool : 0 net.sf.hibernate.cfg.SettingsFactory INFO - echoing all SQL to stdout
[2005-02-04 10:00:34,020] MessageListenerThreadPool : 0 net.sf.hibernate.cfg.SettingsFactory INFO - Query language substitutions: {}
[2005-02-04 10:00:34,020] MessageListenerThreadPool : 0 net.sf.hibernate.cfg.SettingsFactory INFO - cache provider: net.sf.hibernate.cache.EhCacheProvider
[2005-02-04 10:00:34,020] MessageListenerThreadPool : 0 net.sf.hibernate.cfg.Configuration INFO - instantiating and configuring caches
[2005-02-04 10:00:34,754] MessageListenerThreadPool : 0 net.sf.hibernate.impl.SessionFactoryImpl INFO - building session factory
[2005-02-04 10:00:35,832] MessageListenerThreadPool : 0 net.sf.hibernate.impl.SessionFactoryObjectFactory INFO - Not binding factory to JNDI, no JNDI name configured
[2005-02-04 10:00:35,832] MessageListenerThreadPool : 0 net.sf.hibernate.transaction.WebSphereTransactionManagerLookup INFO - WebSphere 5.0
[2005-02-04 10:00:35,832] MessageListenerThreadPool : 0 com.sscims.cdag.util.HibernateUtil DEBUG - setSessionFactory: end
[2005-02-04 10:00:35,895] MessageListenerThreadPool : 0 com.sscims.cdag.util.ThreadLocalSession DEBUG - currentSession: Session opened
[2005-02-04 10:00:35,895] MessageListenerThreadPool : 0 com.sscims.cdag.util.ThreadLocalSession DEBUG - currentSession: session: net.sf.hibernate.impl.SessionImpl@1bc303c4
[2005-02-04 10:00:35,895] MessageListenerThreadPool : 0 com.sscims.cdag.util.ThreadLocalSession DEBUG - currentSession: referenceCount: 1
[2005-02-04 10:00:35,895] MessageListenerThreadPool : 0 com.sscims.cdag.util.ThreadLocalSession DEBUG - currentSession: end
[2005-02-04 10:00:35,926] MessageListenerThreadPool : 0 com.sscims.cdag.dao.DataElementDAO DEBUG - getDataElement - begin
[2005-02-04 10:00:35,926] MessageListenerThreadPool : 0 com.sscims.cdag.dao.BaseDAO DEBUG - findUnique - begin
[2005-02-04 10:00:35,926] MessageListenerThreadPool : 0 com.sscims.cdag.util.HibernateQueryHelper DEBUG - find: begin
[2005-02-04 10:00:35,926] MessageListenerThreadPool : 0 com.sscims.cdag.util.ThreadLocalSession DEBUG - currentSession: begin
[2005-02-04 10:00:35,926] MessageListenerThreadPool : 0 com.sscims.cdag.util.ThreadLocalSession DEBUG - currentSession: session: net.sf.hibernate.impl.SessionImpl@1bc303c4
[2005-02-04 10:00:35,926] MessageListenerThreadPool : 0 com.sscims.cdag.util.ThreadLocalSession DEBUG - currentSession: referenceCount: 2
[2005-02-04 10:00:35,926] MessageListenerThreadPool : 0 com.sscims.cdag.util.ThreadLocalSession DEBUG - currentSession: end
[2005-02-04 10:00:36,113] MessageListenerThreadPool : 0 com.sscims.cdag.util.HibernateQueryHelper ERROR - find: find() failed
net.sf.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3357)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3321)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:66)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:779)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1553)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1530)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1526)
at com.sscims.cdag.util.HibernateQueryHelper.find(HibernateQueryHelper.java:65)
at com.sscims.cdag.dao.BaseDAO.findUnique(BaseDAO.java:42)
at com.sscims.cdag.dao.DataElementDAO.getDataElement(DataElementDAO.java:41)
at com.sscims.cdag.receptor.TextMessageReader.readMessage(TextMessageReader.java:92)
at com.sscims.cdag.receptor.TextMessageProcessor.process(TextMessageProcessor.java:55)
at com.sscims.cdag.receptor.MessageReceptorBean.onMessage(MessageReceptorBean.java:46)
at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:205)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:194)
at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:172)
at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:905)
at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:696)
at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:481)
at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:448)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:90)
at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:120)
at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:372)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
Caused by:
javax.transaction.RollbackException
at com.ibm.ejs.jts.jta.TransactionImpl.registerSynchronization(TransactionImpl.java:955)
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3352)
|