1 Reply Latest reply on Nov 17, 2007 12:16 PM by Ronald van Kuijk

    Session closed exception

    Ankur Agarwal Newbie

      Hi,

      We have a Weblogic portal based application using Spring, Hibernate. We now are trying to use JBPM in the application. Have created seperate db schema for jBPM and a different datasource as well.

      What I am doing is calling another class (JBPM Action Handler) from my service class and coming back again to my service class.
      Inside JBPM class, I don't use any entity from the existing application, but when I return to my service class and try to update an entity this exception occurs.

      JBPM code snippet is sth like:
      ---------------------
      JBPMWorkFlowUtil utilEngine = new JBPMWorkFlowUtil();
      utilEngine.beginTransaction();

      ProcessInstance processInstance = utilEngine.getProcessInstance(Constants.CREATE_OPPORTUNITY, opportunityVO.getProcessInstanceId());

      utilEngine.setVariable(processInstance, Constants.REQUEST_RESOLUTION, opportunityVO.getRequestResolutionStatus());
      utilEngine.signal(processInstance);
      utilEngine.saveProcessInstance(processInstance);

      String nextAction = (String) utilEngine.getVariable(processInstance, Constants.NEXT_ACTION);
      utilEngine.endTransaction();
      ---------------------

      utilEngine.endTransaction(); does closeContext as well.

      We are using a different hibernate.cfg.xml for jbpm i.e. different session-factory which in effect means 2 different sessions, one for existing application entities and one for jbpm entities.
      I don't know the reason why this session is getting closed, as I am not doing it in my code anywhere.


      ===============================

      <Nov 16, 2007 1:05:21 PM IST> <BEA-010026> <Exception occurred during commit of transaction Name=[EJB com.colt.service.bean.ResolveBean.saveResolution(com.c
      olt.valueobject.RequestDetailsVO,long,java.lang.String)],Xid=BEA1-0B4430DD47E481527AEA(52801977),Status=Rolled back. [Reason=org.hibernate.SessionException: Session is cl
      osed!],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since begin=8,seconds left=60,XAServerResourceInfo[coltDataSource]=(ServerResourceInfo[coltDataSource]=(state=rol
      ledback,assigned=AdminServer),xar=coltDataSource,re-Registered = false),SCInfo[ColtPortalDomain+AdminServer]=(state=rolledback),properties=({weblogic.transaction.name=[EJ
      B com.colt.service.bean.ResolveBean.saveResolution(com.colt.valueobject.RequestDetailsVO,long,java.lang.String)]}),local properties=({weblogic.jdbc.jta.coltDataSource=[ N
      o XAConnection is attached to this TxInfo ]}),OwnerTransactionManager=ServerTM[ServerCoordinatorDescriptor=(CoordinatorURL=AdminServer+10.208.60.130:7001+ColtPortalDomain
      +t3+, XAResources={coltDataSource, portalDataSourceAlwaysXA, WLStore_ColtPortalDomain_WseeFileStore, WLStore_ColtPortalDomain__WLS_AdminServer, samplesDataSource, WLStore
      _ColtPortalDomain_pfProliferationJMSStore, portalDataSource},NonXAResources={})],CoordinatorURL=AdminServer+10.208.60.130:7001+ColtPortalDomain+t3+): weblogic.transaction
      .RollbackException: Unexpected exception in beforeCompletion: sync=org.jbpm.db.JobSession$DeleteJobsSynchronization@2251404
      Session is closed!
      at weblogic.transaction.internal.TransactionImpl.throwRollbackException(TransactionImpl.java:1782)
      at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:331)
      at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:227)
      at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:436)
      at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
      at com.colt.service.bean.ResolveBean_dl7jb4_ELOImpl.saveResolution(ResolveBean_dl7jb4_ELOImpl.java:462)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
      at org.apache.beehive.controls.system.ejb.EJBControlImpl.invoke(EJBControlImpl.java:399)
      at controls.ResolveBeanCtrlBean.saveResolution(ResolveBeanCtrlBean.java:738)
      at pageFlowControllers.resolveRequest.ResolveRequestController.submitCreditCheckRequest(ResolveRequestController.java:1447)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
      at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:869)
      at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:808)
      at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:477)
      at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:305)
      at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:335)
      at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:51)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
      at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:95)
      at org.apache.beehive.netui.pageflow.PageFlowRequestProcessor$ActionRunner.execute(PageFlowRequestProcessor.java:2042)
      at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:63)
      at org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor.wrapAction(ActionInterceptor.java:167)
      at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.invoke(ActionInterceptors.java:49)
      at org.apache.beehive.netui.pageflow.interceptor.action.internal.ActionInterceptors$WrapActionInterceptorChain.continueChain(ActionInterceptors.java:57)
      .>
      Could not find exception handler method handleException for javax.ejb.TransactionRolledbackLocalException.
      Could not find exception handler method handleException for javax.ejb.EJBException.
      Could not find exception handler method handleException for java.lang.RuntimeException.
      error while evaluating expression in exception-handler for javax.ejb.TransactionRolledbackLocalException

      ----------
      pageFlowControllers.BaseController handleException: javax.ejb.TransactionRolledbackLocalException: Error committing transaction:; nested exception is: org.hibernate.Sessi
      onException: Session is closed!
      org.hibernate.SessionException: Session is closed!
      at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
      at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1222)
      at org.jbpm.db.JobSession$DeleteJobsSynchronization.beforeCompletion(JobSession.java:190)
      at weblogic.transaction.internal.ServerSCInfo.doBeforeCompletion(ServerSCInfo.java:1150)
      at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:1128)
      at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:115)
      at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:1288)
      at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:2098)
      at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:259)
      at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:227)
      at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:436)
      at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
      at com.colt.service.bean.ResolveBean_dl7jb4_ELOImpl.saveResolution(ResolveBean_dl7jb4_ELOImpl.java:462)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
      at org.apache.beehive.controls.system.ejb.EJBControlImpl.invoke(EJBControlImpl.java:399)
      at controls.ResolveBeanCtrlBean.saveResolution(ResolveBeanCtrlBean.java:738)
      at pageFlowControllers.resolveRequest.ResolveRequestController.submitCreditCheckRequest(ResolveRequestController.java:1447)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
      at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:869)
      at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:808)
      at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:477)
      at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:305)
      at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:335)
      at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:51)
      javax.ejb.TransactionRolledbackLocalException: Error committing transaction:; nested exception is: org.hibernate.SessionException: Session is closed!
      at weblogic.ejb.container.internal.EJBRuntimeUtils.throwTransactionRolledbackLocal(EJBRuntimeUtils.java:226)
      at weblogic.ejb.container.internal.EJBRuntimeUtils.throwEJBException(EJBRuntimeUtils.java:125)
      at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:470)
      at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
      at com.colt.service.bean.ResolveBean_dl7jb4_ELOImpl.saveResolution(ResolveBean_dl7jb4_ELOImpl.java:462)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
      at org.apache.beehive.controls.system.ejb.EJBControlImpl.invoke(EJBControlImpl.java:399)
      at controls.ResolveBeanCtrlBean.saveResolution(ResolveBeanCtrlBean.java:738)
      at pageFlowControllers.resolveRequest.ResolveRequestController.submitCreditCheckRequest(ResolveRequestController.java:1447)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
      at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:869)
      at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:808)
      at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:477)
      at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:305)
      at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:335)
      at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:51)
      at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
      Caused by: org.hibernate.SessionException: Session is closed!
      at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
      at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1222)
      at org.jbpm.db.JobSession$DeleteJobsSynchronization.beforeCompletion(JobSession.java:190)
      at weblogic.transaction.internal.ServerSCInfo.doBeforeCompletion(ServerSCInfo.java:1150)
      at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:1128)
      at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:115)
      at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:1288)
      at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:2098)
      at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:259)
      at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:227)
      at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:436)
      at weblogic.ejb.container.internal.BaseLocalObject.postInvokeTxRetry(BaseLocalObject.java:286)
      at com.colt.service.bean.ResolveBean_dl7jb4_ELOImpl.saveResolution(ResolveBean_dl7jb4_ELOImpl.java:462)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
      at org.apache.beehive.controls.system.ejb.EJBControlImpl.invoke(EJBControlImpl.java:399)
      at controls.ResolveBeanCtrlBean.saveResolution(ResolveBeanCtrlBean.java:738)
      at pageFlowControllers.resolveRequest.ResolveRequestController.submitCreditCheckRequest(ResolveRequestController.java:1447)
      at jrockit.reflect.VirtualNativeMethodInvoker.invoke(Ljava.lang.Object;[Ljava.lang.Object;)Ljava.lang.Object;(Unknown Source)
      at java.lang.reflect.Method.invoke(Ljava.lang.Object;[Ljava.lang.Object;I)Ljava.lang.Object;(Unknown Source)
      at org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:869)
      at org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:808)
      at org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:477)
      at org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:305)
      at org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:335)
      at org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:51)

      ===============

      Your early response is very much appreciated.