-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 
Author Message
 Post subject: WebSphere 5.1 Transaction Management and Hibernate 2.1.8
PostPosted: Fri Feb 04, 2005 2:25 am 
Newbie

Joined: Wed Jan 05, 2005 11:32 pm
Posts: 7
My application uses CMTs. I have been having problems with it in WebSphere 5.1 and Hibernate 2.1.6. If I tried to use java:comp/UserTransaction, I got a NameNotFoundException (as have others reported in this forum).

After the release of Hibernate 2.1.8, I tried againg based on the fix this release contains to issue 1354. However I am still getting NameNotFoundException. I am not sure if this fix applies to WebSphere 5.1 (the documentation only mentions WAS 6.0)., so I thought I would try it and find out.

I would appreciate any help in getting this configuration to work.

Thanks,

Jeff

The following is the transaction section of my hibernate.properties file. I added properties based on document attached to 1354

I am using Hibernate 2.1.8:

#######################
### Transaction API ###
#######################

## the Transaction API abstracts application code from the underlying JTA or JDBC transactions

hibernate.transaction.factory_class net.sf.hibernate.transaction.JTATransactionFactory
#hibernate.transaction.factory_class net.sf.hibernate.transaction.JDBCTransactionFactory


hibernate.transaction.flush_before_completion true
hibernate.transaction.auto_close_session true

## to use JTATransactionFactory, Hibernate must be able to locate the UserTransaction in JNDI
## default is java:comp/UserTransaction
## you do NOT need this setting if you specify hibernate.transaction.manager_lookup_class

#jta.UserTransaction jta/usertransaction
#jta.UserTransaction javax.transaction.UserTransaction
#jta.UserTransaction UserTransaction


## to use JCS caching with JTA, Hibernate must be able to obtain the JTA TransactionManager

#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.JBossTransactionManagerLookup
#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WeblogicTransactionManagerLookup
#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WebSphereTransactionManagerLookup
#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.OrionTransactionManagerLookup
#hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.ResinTransactionManagerLookup

hibernate.transaction.manager_lookup_class net.sf.hibernate.transaction.WebSphereExtendedJTATransactionLookup
:


public void insertOrUpdate(ProcessInstance pi) throws HibernateException {
Session s = HibernateUtil.openSession();
Transaction tx = s.beginTransaction();
try {
s.saveOrUpdate(pi);
if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine("Inserted or updated processInstance" + pi.getProcessInstanceId() );

tx.commit();
} catch (HibernateException he) {
...
}
finally {
HibernateUtil.closeSession(s);
}

:


2/3/05 22:30:27:808 MST] 49a0357a JTATransactio E net.sf.hibernate.transaction.JTATransaction Could not find UserTransaction in JNDI
[2/3/05 22:30:27:818 MST] 49a0357a JTATransactio E net.sf.hibernate.transaction.JTATransaction TRAS0014I: The following exception was logged javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1021)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:932)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1261)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:194)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:135)
at javax.naming.InitialContext.lookup(InitialContext.java:360)
at net.sf.hibernate.transaction.JTATransaction.begin(JTATransaction.java:133)
at net.sf.hibernate.transaction.JTATransactionFactory.beginTransaction(JTATransactionFactory.java:58)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2252)
at com.versata.bam.ple.audit.ProcessInstanceAccessorLocal.insertOrUpdate(ProcessInstanceAccessorLocal.java:103)
at com.versata.bam.ple.audit.BAMAuditorImpl.insertOrUpdateProcessInstance(BAMAuditorImpl.java:660)
at com.versata.bam.ple.audit.BAMAuditorImpl.stateChanged(BAMAuditorImpl.java:496)
at com.versata.vis.engine.audit._localAuditManagerOperationsImpl.stateChanged(_localAuditManagerOperationsImpl.java:152)
at com.versata.vis.foundation.state.impl.StatefulNotificationImpl.sendNotification(StatefulNotificationImpl.java:192)
at com.versata.vis.foundation.impl.NotificationServiceImpl.deliverSynchronousNotification(NotificationServiceImpl.java:635)
at com.versata.vis.foundation.state.impl.StatefulNotificationHelper.sendStateChanged(StatefulNotificationHelper.java:89)
at com.versata.vis.foundation.state.impl.TransientStatefulSubjectSupport.fireStateChanged(TransientStatefulSubjectSupport.java:96)
at com.versata.vis.engine.entity.impl.StatefulSubjectHomeImpl.memberStateChanged(StatefulSubjectHomeImpl.java:90)
at com.versata.vis.engine.core.impl.StatefulImpl.fireStateChanged(StatefulImpl.java:144)
at com.versata.vis.engine.entity.impl.WorkItemImpl.fireStateChanged(WorkItemImpl.java:1844)
at com.versata.vis.engine.entity.impl.WorkItemImpl.acquireAndUpdate(WorkItemImpl.java:1235)
at com.versata.vis.engine.entity.impl.AutonomousWorkItemImpl.acquire(AutonomousWorkItemImpl.java:129)
at com.versata.vis.engine.entity.impl.AbstractProcessInstanceImpl.execute(AbstractProcessInstanceImpl.java:268)
at com.versata.vis.engine.entity.impl.AutonomousWorkItemImpl.perform(AutonomousWorkItemImpl.java:76)
at com.versata.vis.engine.entity._localEnactSequenceWorkItemOperationsImpl.perform(_localEnactSequenceWorkItemOperationsImpl.java:241)
at com.versata.vis.engine.entity.impl.ProcessImpl.startProcessInstance(ProcessImpl.java:541)
at com.versata.vis.engine.entity._localProcessOperationsImpl.startProcessInstance(_localProcessOperationsImpl.java:184)
at com.versata.pl.engine.facade.ejb.ProcessServiceBean.startProcessInstance(ProcessServiceBean.java:881)
at com.versata.pl.engine.facade.ejb.ProcessServiceSession.startProcessInstance(ProcessServiceSession.java:367)
at com.versata.pl.engine.client.EJSRemoteStatelessProcessService_06f52ee3.startProcessInstance(Unknown Source)
at com.versata.pl.engine.client._EJSRemoteStatelessProcessService_06f52ee3_Tie.startProcessInstance(_EJSRemoteStatelessProcessService_06f52ee3_Tie.java:515)
at com.versata.pl.engine.client._EJSRemoteStatelessProcessService_06f52ee3_Tie._invoke(_EJSRemoteStatelessProcessService_06f52ee3_Tie.java:136)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:602)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:455)
at com.ibm.rmi.iiop.ORB.process(ORB.java:402)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1685)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2173)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
.
javax.naming.NameNotFoundException: Name "comp/UserTransaction" not found in context "java:".
at com.ibm.ws.naming.ipbase.NameSpace.lookupInternal(NameSpace.java:1021)
at com.ibm.ws.naming.ipbase.NameSpace.lookup(NameSpace.java:932)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1261)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:194)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:135)
at javax.naming.InitialContext.lookup(InitialContext.java:360)
at net.sf.hibernate.transaction.JTATransaction.begin(JTATransaction.java:133)
at net.sf.hibernate.transaction.JTATransactionFactory.beginTransaction(JTATransactionFactory.java:58)
at net.sf.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:2252)
at com.versata.bam.ple.audit.ProcessInstanceAccessorLocal.insertOrUpdate(ProcessInstanceAccessorLocal.java:103)
at com.versata.bam.ple.audit.BAMAuditorImpl.insertOrUpdateProcessInstance(BAMAuditorImpl.java:660)
at com.versata.bam.ple.audit.BAMAuditorImpl.stateChanged(BAMAuditorImpl.java:496)
at com.versata.vis.engine.audit._localAuditManagerOperationsImpl.stateChanged(_localAuditManagerOperationsImpl.java:152)
at com.versata.vis.foundation.state.impl.StatefulNotificationImpl.sendNotification(StatefulNotificationImpl.java:192)
at com.versata.vis.foundation.impl.NotificationServiceImpl.deliverSynchronousNotification(NotificationServiceImpl.java:635)
at com.versata.vis.foundation.state.impl.StatefulNotificationHelper.sendStateChanged(StatefulNotificationHelper.java:89)
at com.versata.vis.foundation.state.impl.TransientStatefulSubjectSupport.fireStateChanged(TransientStatefulSubjectSupport.java:96)
at com.versata.vis.engine.entity.impl.StatefulSubjectHomeImpl.memberStateChanged(StatefulSubjectHomeImpl.java:90)
at com.versata.vis.engine.core.impl.StatefulImpl.fireStateChanged(StatefulImpl.java:144)
at com.versata.vis.engine.entity.impl.WorkItemImpl.fireStateChanged(WorkItemImpl.java:1844)
at com.versata.vis.engine.entity.impl.WorkItemImpl.acquireAndUpdate(WorkItemImpl.java:1235)
at com.versata.vis.engine.entity.impl.AutonomousWorkItemImpl.acquire(AutonomousWorkItemImpl.java:129)
at com.versata.vis.engine.entity.impl.AbstractProcessInstanceImpl.execute(AbstractProcessInstanceImpl.java:268)
at com.versata.vis.engine.entity.impl.AutonomousWorkItemImpl.perform(AutonomousWorkItemImpl.java:76)
at com.versata.vis.engine.entity._localEnactSequenceWorkItemOperationsImpl.perform(_localEnactSequenceWorkItemOperationsImpl.java:241)
at com.versata.vis.engine.entity.impl.ProcessImpl.startProcessInstance(ProcessImpl.java:541)
at com.versata.vis.engine.entity._localProcessOperationsImpl.startProcessInstance(_localProcessOperationsImpl.java:184)
at com.versata.pl.engine.facade.ejb.ProcessServiceBean.startProcessInstance(ProcessServiceBean.java:881)
at com.versata.pl.engine.facade.ejb.ProcessServiceSession.startProcessInstance(ProcessServiceSession.java:367)
at com.versata.pl.engine.client.EJSRemoteStatelessProcessService_06f52ee3.startProcessInstance(Unknown Source)
at com.versata.pl.engine.client._EJSRemoteStatelessProcessService_06f52ee3_Tie.startProcessInstance(_EJSRemoteStatelessProcessService_06f52ee3_Tie.java:515)
at com.versata.pl.engine.client._EJSRemoteStatelessProcessService_06f52ee3_Tie._invoke(_EJSRemoteStatelessProcessService_06f52ee3_Tie.java:136)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:602)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:455)
at com.ibm.rmi.iiop.ORB.process(ORB.java:402)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1685)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2173)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

[2/3/05 22:30:27:858 MST] 49a0357a WebSphere5Log W com.versata.bam.ple.audit.BAMAuditorImpl insertOrUpdateProcessInstance caught Hibernate exception on insertOrUpdate process instance
[2/3/05 22:30:28:439 MST] 49a0357a NamingHelper I net.sf.hibernate.util.NamingHelper JNDI InitialContext properties:{}
[2/3/05 22:30:28:459 MST] 49a0357a WebSphere5Log A com.versata.bam.ple.audit.BAMAuditorImpl insertOrUpdateWorkItem caught Hibernate exception on trying to lookup workitem to see if it already exists
[2/3/05 22:30:28:469 MST] 49a0357a NamingHelper I net.sf.hibernate.util.NamingHelper JNDI InitialContext properties:{}
[2/3/05 22:30:28:469 MST] 49a0357a WebSphere5Log W com.versata.bam.ple.audit.BAMAuditorImpl insertOrUpdateWorkItem caught Hibernate exception on insertOrUpdate workitem
[2/3/05 22:30:28:479 MST] 49a0357a NamingHelper I net.sf.hibernate.util.NamingHelper JNDI InitialContext properties:{}
[2/3/05 22:30:28:479 MST] 49a0357a WebSphere5Log A com.versata.bam.ple.audit.BAMAuditorImpl insertOrUpdatePIWorkItem caught Hibernate exception on trying to lookup workitem - it should already exist
[2/3/05 22:30:28:489 MST] 49a0357a ExceptionUtil E CNTR0020E: Non-application exception occurred while processing method "startProcessInstance" on bean "BeanId(ple-engine#ple-facade-ejb-20.jar#ProcessService, null)". Exception data: java.lang.NullPointerException
at com.versata.bam.ple.audit.BAMAuditorImpl.insertOrUpdatePIWorkItem(BAMAuditorImpl.java:868)
at com.versata.bam.ple.audit.BAMAuditorImpl.stateChanged(BAMAuditorImpl.java:514)
at com.versata.vis.engine.audit._localAuditManagerOperationsImpl.stateChanged(_localAuditManagerOperationsImpl.java:152)
at com.versata.vis.foundation.state.impl.StatefulNotificationImpl.sendNotification(StatefulNotificationImpl.java:192)
at com.versata.vis.foundation.impl.NotificationServiceImpl.deliverSynchronousNotification(NotificationServiceImpl.java:635)
at com.versata.vis.foundation.state.impl.StatefulNotificationHelper.sendStateChanged(StatefulNotificationHelper.java:89)
at com.versata.vis.foundation.state.impl.TransientStatefulSubjectSupport.fireStateChanged(TransientStatefulSubjectSupport.java:96)
at com.versata.vis.engine.entity.impl.StatefulSubjectHomeImpl.memberStateChanged(StatefulSubjectHomeImpl.java:90)
at com.versata.vis.engine.core.impl.StatefulImpl.fireStateChanged(StatefulImpl.java:144)
at com.versata.vis.engine.entity.impl.WorkItemImpl.fireStateChanged(WorkItemImpl.java:1844)
at com.versata.vis.engine.entity.impl.WorkItemImpl.enterRunningState(WorkItemImpl.java:1153)
at com.versata.vis.engine.entity.impl.WorkItemImpl.run(WorkItemImpl.java:317)
at com.versata.vis.engine.entity._localWorkItemOperationsImpl.run(_localWorkItemOperationsImpl.java:244)
at com.versata.vis.engine.entity.impl.EnactableElementImpl.createAndConnectWorkItem(EnactableElementImpl.java:308)
at com.versata.vis.engine.entity.impl.ActivityImpl.doStart(ActivityImpl.java:401)
at com.versata.vis.engine.entity.impl.EnactableElementImpl.enact(EnactableElementImpl.java:131)
at com.versata.vis.engine.entity._localActivityOperationsImpl.enact(_localActivityOperationsImpl.java:214)
at com.versata.vis.engine.schema.impl.TransitionImpl.fire(TransitionImpl.java:332)
at com.versata.vis.engine.schema.impl.TransitionImpl.stateChanged(TransitionImpl.java:459)
at com.versata.vis.engine.schema._localTransitionOperationsImpl.stateChanged(_localTransitionOperationsImpl.java:197)
at com.versata.vis.foundation.state.impl.StatefulNotificationImpl.sendNotification(StatefulNotificationImpl.java:192)
at com.versata.vis.foundation.impl.NotificationServiceImpl.deliverSynchronousNotification(NotificationServiceImpl.java:635)
at com.versata.vis.foundation.state.impl.StatefulNotificationHelper.sendStateChanged(StatefulNotificationHelper.java:89)
at com.versata.vis.foundation.state.impl.TransientStatefulSubjectSupport.fireStateChanged(TransientStatefulSubjectSupport.java:96)
at com.versata.vis.engine.entity.impl.WorkItemImpl.notifyOutBoundTransitions(WorkItemImpl.java:2117)
at com.versata.vis.engine.entity.impl.WorkItemImpl.fireStateChanged(WorkItemImpl.java:1861)
at com.versata.vis.engine.entity.impl.WorkItemImpl.complete(WorkItemImpl.java:459)
at com.versata.vis.engine.entity.impl.AutonomousWorkItemImpl.execute(AutonomousWorkItemImpl.java:104)
at com.versata.vis.engine.entity.impl.AutonomousWorkItemImpl.perform(AutonomousWorkItemImpl.java:76)
at com.versata.vis.engine.entity._localInitiateSequenceMapWorkItemOperationsImpl.perform(_localInitiateSequenceMapWorkItemOperationsImpl.java:241)
at com.versata.vis.engine.performance.impl.PerformableNotificationImpl.sendNotification(PerformableNotificationImpl.java:130)
at com.versata.vis.foundation.impl.NotificationServiceImpl.deliverSynchronousNotification(NotificationServiceImpl.java:635)
at com.versata.vis.engine.entity.impl.AutonomousActivityImpl.enact(AutonomousActivityImpl.java:95)
at com.versata.vis.engine.entity._localInitialActivityOperationsImpl.enact(_localInitialActivityOperationsImpl.java:214)
at com.versata.vis.engine.entity.impl.ProcessInstanceImpl.performProcessInstance(ProcessInstanceImpl.java:108)
at com.versata.vis.engine.entity.impl.AbstractProcessInstanceImpl.execute(AbstractProcessInstanceImpl.java:269)
at com.versata.vis.engine.entity.impl.AutonomousWorkItemImpl.perform(AutonomousWorkItemImpl.java:76)
at com.versata.vis.engine.entity._localEnactSequenceWorkItemOperationsImpl.perform(_localEnactSequenceWorkItemOperationsImpl.java:241)
at com.versata.vis.engine.entity.impl.ProcessImpl.startProcessInstance(ProcessImpl.java:541)
at com.versata.vis.engine.entity._localProcessOperationsImpl.startProcessInstance(_localProcessOperationsImpl.java:184)
at com.versata.pl.engine.facade.ejb.ProcessServiceBean.startProcessInstance(ProcessServiceBean.java:881)
at com.versata.pl.engine.facade.ejb.ProcessServiceSession.startProcessInstance(ProcessServiceSession.java:367)
at com.versata.pl.engine.client.EJSRemoteStatelessProcessService_06f52ee3.startProcessInstance(Unknown Source)
at com.versata.pl.engine.client._EJSRemoteStatelessProcessService_06f52ee3_Tie.startProcessInstance(_EJSRemoteStatelessProcessService_06f52ee3_Tie.java:515)
at com.versata.pl.engine.client._EJSRemoteStatelessProcessService_06f52ee3_Tie._invoke(_EJSRemoteStatelessProcessService_06f52ee3_Tie.java:136)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:602)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:455)
at com.ibm.rmi.iiop.ORB.process(ORB.java:402)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1685)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2173)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:64)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))

:


I am using Oracle 9.2.1:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 04, 2005 2:45 pm 
Newbie

Joined: Tue Jan 11, 2005 2:26 pm
Posts: 15
I also had this problem, but changed my property to:

jta.UserTransaction=java:comp/websphere/ExtendedJTATransaction

I got this from a websphere document.

I'm not getting the "NamingNotFoundException", but I am getting the following exceptions. So take it with a grain of salt.

[2005-02-04 10:27:59,916] 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:1172)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:803)
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:1172)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:803)
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:1172)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:803)
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)

net.sf.hibernate.TransactionException: could not register synchronization with JTA TransactionManager
at net.sf.hibernate.impl.SessionImpl.connect(SessionImpl.java:3369)
at net.sf.hibernate.impl.SessionImpl.connection(SessionImpl.java:3333)
at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:67)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:784)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1554)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1531)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1527)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 4:03 pm 
Newbie

Joined: Tue Oct 19, 2004 3:39 pm
Posts: 11
The problem you are facing is that you can not use the Hibernate Transaction API's directly. As such, you can't :
Transaction tx = s.beginTransaction();
This will end up trying to lookup the userTransaction by default, which in a CMT is not available in WAS 5.1 and higher.
Take a look at HB-1354 there is some fixes regarding this problem...


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 5:01 pm 
Newbie

Joined: Wed Jan 05, 2005 11:32 pm
Posts: 7
Thanks for your reply. I am trying to test this with the fix for issue HB-1354. which I understand addresses this problem.

Is your suggestion that I remove the explicit transaction begin/commit calls?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 5:07 pm 
Newbie

Joined: Tue Oct 19, 2004 3:39 pm
Posts: 11
yes you must do this. Hibernate transaction api will try to get the userTransaction. Check the code, you'll see it. This will throw an exception every time in WAS 5.1 or 6.0. Be careful, there are some slight differences between 5.1 and 6.0, I had to step through the code many times to figure them out. And the documentation for the ExtendedJTA... from IBM is horrible. You'll need to turn on the trace in your WAS and make sure you don't see any strange <malformed parameter> errors.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 5:38 pm 
Newbie

Joined: Tue Oct 19, 2004 3:39 pm
Posts: 11
1 other thing I can see, you can not close your hibernate Session in the finally block.

The container will need to access that session in the beforeCompletion and afterCompletion events. If it (the Hibernate Session) is closed somewhere underneath of your SLSB in a finally block you'll never see the rows committed - even if everything was successful.

You'll need to adjust your session closing logic, I've deferred the processing to the afterCOmpletion code, but, I've also had to make some changes to the handling of sessions when using ThreadLocal, which I'm assuming you are using in your HibernateUtil.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 07, 2005 6:27 pm 
Newbie

Joined: Tue Jan 11, 2005 2:26 pm
Posts: 15
Hi jupson_us,

Can you post some more details on how you had to adjust your ThreadLocal session?

Thanks,
-Ben


Top
 Profile  
 
 Post subject: Re: WebSphere 5.1 Transaction Management and Hibernate 2.1.8
PostPosted: Mon Feb 07, 2005 7:00 pm 
Senior
Senior

Joined: Tue Aug 03, 2004 2:11 pm
Posts: 142
Location: Somerset
jeffdelong wrote:
I would appreciate any help in getting this configuration to work.



Without going into the specifics of your problem I'm using hibernate 2.1.8 under Websphere 5.1, with all the code being called from session EJBs, with no problem at all.

The difference is is that I am using Spring to wrap the Hibernate code. If you come to a dead end give me a shout and I can point you in the direction of my Spring version (nb, at the moment, soon migrating to h3 and ditching spring)

_________________
On the information super B road


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 11, 2005 2:56 pm 
Newbie

Joined: Wed Jan 05, 2005 11:32 pm
Posts: 7
After examing in the code I see what jupson_us says is true. However it appears the WebSphereExtendedJTATransaction support is could be enhanced. It appears to me that what is necessary is a new subclass of Transaction, WebSphereExtendedJTATransaction, and TransactionFactory, WebSphereExtendedJTATransactionFactory, that provides WebSphereExtendedJTATransaction support. This would include looking up
the

ExtendedJTATransaction=java:comp/websphere/ExtendedJTATransaction

And would be configured via:

hibernate.transaction.factory_class net.sf.hibernate.transaction.WebSphereExtendedJTATransactionFactory

both of which could be configured in hibernate.properties.

This does create redundant code just to handle WebSphere. However in this way the application code could be app server independent, which is important for my application. Does this make sense?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 14, 2005 3:45 pm 
Newbie

Joined: Tue Oct 19, 2004 3:39 pm
Posts: 11
If you want to be app server independent, then this makes sense to me. The other complicated area to address is the handling of the Hibernate session. If you're using the ThreadLocal session approach then you're going to have to implement some enhancements there. (That being said, I'm not sure this problem is specific to Websphere, I believe this is likely the case with any CMT.)


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 05, 2005 11:37 pm 
Newbie

Joined: Wed Jan 05, 2005 11:32 pm
Posts: 7
I believe I have finally resolved this issue by migrating up to Hibernate 3.0.2 and using getCurrentSession(), and removing all explicit transaction demarcation logic from my application.


Top
 Profile  
 
 Post subject: Re: WebSphere 5.1 Transaction Management and Hibernate 2.1.8
PostPosted: Tue Aug 23, 2005 3:56 am 
Senior
Senior

Joined: Tue Aug 03, 2004 2:11 pm
Posts: 142
Location: Somerset
jeffdelong wrote:
My application uses CMTs. I have been having problems with it in WebSphere 5.1 and Hibernate 2.1.6. If I tried to use java:comp/UserTransaction, I got a NameNotFoundException (as have others reported in this forum).


We use Hibernate (albeit version 3, but the same applied to 2 when we were using that), and didn't bother about coding any transactional stuff whatsoever.

Howcome ?

We used the inversion of control stuff that Spring provides, and let the containers and Spring work out when to commit or rollback transactions, and to open and close sessions.

Works like an absolute dream.

Check out here

http://www.springframework.org/docs/wik ... rnate.html

_________________
On the information super B road


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 12 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.