Я использую Spring с Hibernate Envers для вставки записей в таблицы аудита. Когда приложение Wicket (веб) вызывает сервис, я вижу, что Spring использует OpenSessionViewFiler и устанавливает flushmode на Manual. AuditProcess класс следующий код в методе doBeforeTransactionCompletion:
if (FlushMode.isManualFlushMode(session.getFlushMode())) {
IsManual становится true, затем он использует временный сеанс для вставки записи в таблицы аудита. Работает нормально.
У нас есть другое приложение EJB, Spring, Hibernate в WebSphere. Когда мы вызываем тот же сервис из EJB, flushmode становится AUTO, и он завершается с ошибкой в классе AuditProcess в вышеупомянутом методе с ошибкой:
"WTRN0074E: Exception caught from before_completion synchronization
operation: org.hibernate.SessionException: Session is closed!"
Пожалуйста, дайте мне знать ваши идеи для решения этой проблемы:
[4/23/11 17:42:53:582 CDT] 00000023 RegisteredSyn E WTRN0074E: Exception
caught from before_completion synchronization operation:
org.hibernate.SessionException: Session is closed!
at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:72)
at org.hibernate.impl.SessionImpl.contains(SessionImpl.java:1739)
at org.hibernate.envers.synchronization.AuditProcess.getCurrentRevisionData(AuditProcess.java:125)
at org.hibernate.envers.synchronization.AuditProcess.executeInSession(AuditProcess.java:104)
at org.hibernate.envers.synchronization.AuditProcess.doBeforeTransactionCompletion(AuditProcess.java:152)
at org.hibernate.engine.ActionQueue$BeforeTransactionCompletionProcessQueue.beforeTransactionCompletion(ActionQueue.java:543)
at org.hibernate.engine.ActionQueue.beforeTransactionCompletion(ActionQueue.java:216)
at org.hibernate.impl.SessionImpl.beforeTransactionCompletion(SessionImpl.java:571)
at org.hibernate.jdbc.JDBCContext.beforeTransactionCompletion(JDBCContext.java:250)
at org.hibernate.transaction.synchronization.CallbackCoordinator.beforeCompletion(CallbackCoordinator.java:125)
at org.hibernate.transaction.synchronization.HibernateSynchronizationImpl.beforeCompletion(HibernateSynchronizationImpl.java:51)
at org.hibernate.transaction.WebSphereExtendedJTATransactionLookup$TransactionManagerAdapter$TransactionAdapter$1.invoke(WebSphereExtendedJTATransactionLookup.java:209)
at $Proxy44.beforeCompletion(Unknown Source)
at com.ibm.ws.jtaextensions.SynchronizationCallbackWrapper.beforeCompletion(SynchronizationCallbackWrapper.java:65)
at com.ibm.ws.Transaction.JTA.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:242)
at com.ibm.ws.Transaction.JTA.TransactionImpl.prePrepare(TransactionImpl.java:2408)
at com.ibm.ws.Transaction.JTA.TransactionImpl.stage1CommitProcessing(TransactionImpl.java:1641)
at com.ibm.ws.Transaction.JTA.TransactionImpl.processCommit(TransactionImpl.java:1612)
at com.ibm.ws.Transaction.JTA.TransactionImpl.commit(TransactionImpl.java:1547)
at com.ibm.ws.Transaction.JTA.TranManagerImpl.commit(TranManagerImpl.java:247)
at com.ibm.ws.Transaction.JTA.TranManagerSet.commit(TranManagerSet.java:167)
at com.ibm.ws.uow.UOWManagerImpl.uowCommit(UOWManagerImpl.java:1055)
at com.ibm.ws.uow.UOWManagerImpl.uowEnd(UOWManagerImpl.java:1025)
at com.ibm.ws.uow.UOWManagerImpl.runUnderNewUOW(UOWManagerImpl.java:975)
at com.ibm.ws.uow.UOWManagerImpl.runUnderUOW(UOWManagerImpl.java:509)
at org.springframework.transaction.jta.WebSphereUowTransactionManager.execute(WebSphereUowTransactionManager.java:281)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:127)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at $Proxy66.getAocBufferData(Unknown Source)
at com.cvscaremark.links.submitorder.SubmitOrderFacade.executeSubmitOrderServices(SubmitOrderFacade.java:59)
at com.cvscaremark.links.submitorder.SubmitOrderBean.processSubmitOrder(SubmitOrderBean.java:129)
at com.cvscaremark.links.submitorder.SubmitOrderBean.ejbTimeout(SubmitOrderBean.java:102)
at com.ibm.ejs.container.TimedObjectWrapper.ejbTimeout(TimedObjectWrapper.java:90)
at com.ibm.ejs.container.TimerTaskHandler.doWork(TimerTaskHandler.java:265)
at com.ibm.ws.scheduler.AlarmListener.executeTaskWithNotification(AlarmListener.java:795)
at com.ibm.ws.scheduler.AlarmListener.access$700(AlarmListener.java:120)
at com.ibm.ws.scheduler.AlarmListener$TaskWork.doWork(AlarmListener.java:426)
at com.ibm.ws.scheduler.AlarmListener$TaskWork.run(AlarmListener.java:212)
at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:782)
at com.ibm.ws.asynchbeans.ExecutionContextImpl.go(ExecutionContextImpl.java:85)
at com.ibm.ws.scheduler.AlarmListener.fireTask(AlarmListener.java:1400)
at com.ibm.ws.scheduler.AlarmListener.fired(AlarmListener.java:1318)
at com.ibm.ws.asynchbeans.AlarmImpl.callListenerMethod(AlarmImpl.java:338)
at com.ibm.ws.asynchbeans.timer.GenericTimer.run(GenericTimer.java:216)
at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1150)
at com.ibm.ws.asynchbeans.AlarmImpl.runListenerAsCJWork(AlarmImpl.java:173)
at com.ibm.ws.asynchbeans.am._Alarm.fireAlarm(_Alarm.java:332)
at com.ibm.ws.asynchbeans.am._Alarm.run(_Alarm.java:229)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)
Спасибо за вашу помощь,
Venkat