4 Replies Latest reply on Oct 12, 2009 9:42 AM by Jakub Maly

    Ending task with timer - session is closed

    Jakub Maly Newbie

      Hi,

      I'm using following configuration:
      JBoss AS 4.3
      jBPM 3.2.2
      Seam 2.0.2
      Hibernate 3.3.0

      jBPM is configured to use JTA. JbpmContext is injected with Hibernate session took from Seam managed EntityManager.

      When I end task, which has a timer, everything works fine but at the end of rendering phase exception is thrown:

      02:50:26,345 ERROR [TaskMgmtSession] org.hibernate.SessionException: Session is closed!
      02:50:26,438 ERROR [SeamPhaseListener] uncaught exception
      org.jbpm.JbpmException: couldn't get task instance '146'
       at org.jbpm.db.TaskMgmtSession.getTaskInstance(TaskMgmtSession.java:190)
       at org.jbpm.JbpmContext.getTaskInstanceForUpdate(JbpmContext.java:251)
       at org.jboss.seam.bpm.TaskInstance$1.work(TaskInstance.java:49)
       at org.jboss.seam.bpm.TaskInstance$1.work(TaskInstance.java:43)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:41)
       at org.jboss.seam.bpm.TaskInstance.getTaskInstance(TaskInstance.java:39)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
       at org.jboss.seam.Component.callComponentMethod(Component.java:2092)
       at org.jboss.seam.Component.unwrap(Component.java:2118)
       at org.jboss.seam.Component.getInstance(Component.java:1890)
       at org.jboss.seam.Component.getInstance(Component.java:1855)
       at org.jboss.seam.Component.getInstance(Component.java:1832)
       at org.jboss.seam.Component.getInstance(Component.java:1827)
       at org.jboss.seam.bpm.TaskInstance.instance(TaskInstance.java:64)
       at org.jboss.seam.contexts.BusinessProcessContext.getTaskInstance(BusinessProcessContext.java:231)
       at org.jboss.seam.contexts.BusinessProcessContext.getNamesFromContext(BusinessProcessContext.java:109)
       at org.jboss.seam.contexts.BusinessProcessContext.getNames(BusinessProcessContext.java:97)
       at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:241)
       at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:356)
       at org.jboss.seam.contexts.FacesLifecycle.endRequest(FacesLifecycle.java:112)
       at org.jboss.seam.jsf.SeamPhaseListener.afterRenderResponse(SeamPhaseListener.java:513)
       at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:245)
       at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
       at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: org.hibernate.SessionException: Session is closed!
       at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
       at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:874)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
       at org.jbpm.db.TaskMgmtSession.getTaskInstance(TaskMgmtSession.java:186)
       ... 68 more
      02:50:26,438 ERROR [SeamPhaseListener] swallowing exception
      org.jbpm.JbpmException: couldn't get task instance '146'
       at org.jbpm.db.TaskMgmtSession.getTaskInstance(TaskMgmtSession.java:190)
       at org.jbpm.JbpmContext.getTaskInstanceForUpdate(JbpmContext.java:251)
       at org.jboss.seam.bpm.TaskInstance$1.work(TaskInstance.java:49)
       at org.jboss.seam.bpm.TaskInstance$1.work(TaskInstance.java:43)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:41)
       at org.jboss.seam.bpm.TaskInstance.getTaskInstance(TaskInstance.java:39)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
       at org.jboss.seam.Component.callComponentMethod(Component.java:2092)
       at org.jboss.seam.Component.unwrap(Component.java:2118)
       at org.jboss.seam.Component.getInstance(Component.java:1890)
       at org.jboss.seam.Component.getInstance(Component.java:1855)
       at org.jboss.seam.Component.getInstance(Component.java:1832)
       at org.jboss.seam.Component.getInstance(Component.java:1827)
       at org.jboss.seam.bpm.TaskInstance.instance(TaskInstance.java:64)
       at org.jboss.seam.contexts.BusinessProcessContext.getTaskInstance(BusinessProcessContext.java:231)
       at org.jboss.seam.contexts.BusinessProcessContext.getNamesFromContext(BusinessProcessContext.java:109)
       at org.jboss.seam.contexts.BusinessProcessContext.getNames(BusinessProcessContext.java:97)
       at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:241)
       at org.jboss.seam.contexts.Contexts.flushAndDestroyContexts(Contexts.java:356)
       at org.jboss.seam.contexts.FacesLifecycle.endRequest(FacesLifecycle.java:112)
       at org.jboss.seam.jsf.SeamPhaseListener.afterRenderResponse(SeamPhaseListener.java:513)
       at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:245)
       at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:192)
       at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:175)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:114)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
       at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
       at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
       at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
       at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
       at java.lang.Thread.run(Thread.java:619)
      Caused by: org.hibernate.SessionException: Session is closed!
       at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
       at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:874)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:815)
       at org.hibernate.impl.SessionImpl.get(SessionImpl.java:808)
       at org.jbpm.db.TaskMgmtSession.getTaskInstance(TaskMgmtSession.java:186)
       ... 68 more
      


      I'm confused what is seam trying to do on destroying of context and where is TaskInstance, which it tries to retrieve, registered. Has it something to do with JobExecutor? Or any other suggestions?

      Thank you.
      regards,
      Jakub

        • 1. Re: Ending task with timer - session is closed
          Jakub Maly Newbie

          Ok,

          nobody met same issue? With mentioned configuration it seems that helped us to disable cureent session for persistence service - by changing in jbpm.configuration.xml:

           <service name="persistence">
           <factory>
           <bean class="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory">
           <field name="isTransactionEnabled"><false/></field>
           <field name="isCurrentSessionEnabled"><false/></field>
           </bean>
           </factory>
           </service>
          


          It helped in earlier described case, but seems it happens in another scenarios which I need to scan more in detail later.

          Also I think I need to specify configuration more precisely , which contains jbpm deployed twice - once in our application and once within default deployment which comes with JBoss SOA Platform 4.3 which we are using. Job executor is configured in default jbpm deployment, not in our application.

          But my knowledge of JBPM and Seam is not so deep to know what and why it happens, so if anybody can give an explanation, it will be appreciated.

          Jakub.

          • 2. Re: Ending task with timer - session is closed
            Alejandro Guizar Master

            Seems like an instance of JBPM-1135. By disabling the current session, jBPM is creating a separate session rather than using the existing one, which explains why your modified configuration works. It may not employ resources in the most efficient manner, tough.

            I would suggest upgrading to jBPM 3.2.4 or later, but I realize Seam is pinning jBPM on version 3.2.2. The only real soution would be to have the Seam guys upgrade to a later version of jBPM.

            • 3. Re: Ending task with timer - session is closed
              Ronald van Kuijk Master

              3.2.6SP1 can be used as a drop-in replacement for the jbpm jar in seam. Serveral people tried that and it works.

              • 4. Re: Ending task with timer - session is closed
                Jakub Maly Newbie

                Hi,

                thanks for your replies, brings a little light to it.

                As I said in second post, we use JBoss SOA Platform 4.3. In a last cumulative patch CP02 there are updated several versions. Within SOA it self, there is jBPM 3.2.7 (in jbpm.esbm with jbpm console), in Seam 2.0.2 FP (which is a part of platform) there is 3.2.5 SP5 version. I'll try later (soon, hopefully) these versions (also with Ronald mentioned 3.2.6SP1) and let you know my experiences.

                Thank you.

                regards, Jakub.