[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2124?page=c...
]
Chris Bredesen commented on HHH-2124:
-------------------------------------
The crux of the issue here is how to setRollbackOnly() from inside a component on WAS
using CMT. We don't have access to EJBContext and we can't use
TransactionManager. How are we meant to express to JTA that the Tx should finish with a
rollback? If this question can be answered, I can fix this without too much hassle.
HibernateException hidden during flush using XA with WAS6
---------------------------------------------------------
Key: HHH-2124
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2124
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.1.3, 3.2.0 cr1, 3.2.0.cr2, 3.2.0.cr3, 3.2.0.cr4, 3.2.0.cr5,
3.2.0.ga, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.4.sp1, 3.2.5
Environment: Hibernate 3.1.3
Oracle 10G
Websphere Application Server 6
Reporter: Ole Dalgaard
Assignee: Chris Bredesen
In an XA environment, using WebSphereExtendedJTATransactionLookup, HibernateExceptions
are hidden during flush in this code in CacheSynchronization.java
try {
if (flush) {
log.trace("automatically flushing session");
ctx.managedFlush();
}
}
catch (RuntimeException re) {
setRollbackOnly();
throw re;
}
After adding some logging to CacheSynchronization.beforeCompletion I got this error
message:
org.hibernate.HibernateException: Illegal attempt to associate a collection with two open
sessions
at
org.hibernate.collection.AbstractPersistentCollection.setCurrentSession(AbstractPersistentCollection.java:410)
at org.hibernate.event.def.OnUpdateVisitor.processCollection(OnUpdateVisitor.java:40)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java(Compiled
Code))
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java(Compiled
Code))
at
org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java(Compiled
Code))
at org.hibernate.event.def.AbstractVisitor.process(AbstractVisitor.java:123)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performUpdate(DefaultSaveOrUpdateEventListener.java:267)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsDetached(DefaultSaveOrUpdateEventListener.java:216)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93)
at
org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:502)
at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:494)
at org.hibernate.engine.CascadingAction$5.cascade(CascadingAction.java:134)
at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java(Inlined Compiled Code))
at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java(Compiled Code))
at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java(Compiled Code))
at org.hibernate.engine.Cascade.cascade(Cascade.java(Compiled Code))
at
org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:130)
at
org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:121)
at
org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
at
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at
org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:60)
at
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter$1.invoke(WebSphereExtendedJTATransactionLookup.java:136)
at $Proxy11.beforeCompletion(Unknown Source)
at
com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.beforeCompletion(SynchronizationCallbackWrapper.java:65)
at
com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeBefore(RegisteredSyncs.java(Compiled
Code))
at com.ibm.ws.Transaction.JTA.TransactionImpl.prePrepare(TransactionImpl.java(Compiled
Code))
at
com.ibm.ws.Transaction.JTA.TransactionImpl.stage1CommitProcessing(TransactionImpl.java(Compiled
Code))
at
com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(TransactionImpl.java(Compiled
Code))
at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(TransactionImpl.java(Compiled
Code))
at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(TranManagerImpl.java(Compiled
Code))
at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(TranManagerSet.java(Compiled Code))
at com.ibm.ejs.csi.TranStrategy.commit(TranStrategy.java:716)
at com.ibm.ejs.csi.TranStrategy.postInvoke(TranStrategy.java:167)
at com.ibm.ejs.csi.TransactionControlImpl.postInvoke(TransactionControlImpl.java:569)
at com.ibm.ejs.container.EJSContainer.postInvoke(EJSContainer.java:3801)
at
com.ibm.ws.webservices.dispatchers.ejb.WSEJBWrapper.postInvoke(WSEJBWrapper.java:153)
at
com.ibm.ws.webservices.dispatchers.ejb.J2ee14EJBDispatcher.cleanupEnvironment(J2ee14EJBDispatcher.java:197)
at
com.ibm.ws.webservices.engine.handlers.jaxrpc.JAXRPCHandler.invoke(JAXRPCHandler.java:148)
at com.ibm.ws.webservices.engine.handlers.WrappedHandler.invoke(WrappedHandler.java:64)
at
com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:225)
at
com.ibm.ws.webservices.engine.PivotHandlerWrapper.invoke(PivotHandlerWrapper.java:225)
at com.ibm.ws.webservices.engine.WebServicesEngine.invoke(WebServicesEngine.java:279)
at
com.ibm.ws.webservices.engine.transport.http.WebServicesServlet.doPost(WebServicesServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at
com.ibm.ws.webservices.engine.transport.http.WebServicesServletBase.service(WebServicesServletBase.java:341)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1282)
at
com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:673)
at
com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1804)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:469)
at
com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:408)
at
com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:101)
at
com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
Without modifying CacheSynchronization I only get this:
WTRN0074E: Exception caught from before_completion synchronization operation:
java.lang.UnsupportedOperationException
at
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter.setRollbackOnly(WebSphereExtendedJTATransactionLookup.java:211)
at
org.hibernate.transaction.CacheSynchronization.setRollbackOnly(CacheSynchronization.java:77)
at
org.hibernate.transaction.CacheSynchronization.beforeCompletion(CacheSynchronization.java:67)
at
org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter$1.invoke(WebSphereExtendedJTATransactionLookup.java:136)
at $Proxy11.beforeCompletion(Unknown Source)
at
com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.beforeCompletion(SynchronizationCallbackWrapper.java:65)
at
com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeBefore(RegisteredSyncs.java(Compiled
Code))
at com.ibm.ws.Transaction.JTA.TransactionImpl.prePrepare(TransactionImpl.java(Compiled
Code))
.....
I use these transaction settings for hibernate:
<property
name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property
name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.WebSphereExtendedJTATransactionLookup</property>
<property
name="hibernate.transaction.flush_before_completion">true</property>
<property
name="hibernate.transaction.auto_close_session">true</property>
--
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