0 Replies Latest reply on Sep 4, 2008 3:55 AM by yuyanshan

    jbpm3.2+ springmodules3.1 session closed ,why?anyone can hel

    yuyanshan

       

       org.hibernate.SessionException: Session is closed!
       at org.hibernate.impl.AbstractSessionImpl.errorIfClosed(AbstractSessionImpl.java:49)
       at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1258)
       at org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:153)
       at com.logansoft.firstFlow.service.impl.JbpmServiceImpl.initJbpm(JbpmServiceImpl.java:128)
       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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
       at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
       at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
       at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
      
      

      here the problem
      if (isCurrentSessionEnabled) {
       session = getSessionFactory().getCurrentSession();
       log.debug("using current hibernate session " + session);
       mustSessionBeClosed = false;
       mustSessionBeFlushed = false;
       mustConnectionBeClosed = false;
       } else if (connection!=null) {
       log.debug("creating hibernate session with connection "+connection);
       session = getSessionFactory().openSession(connection);
       mustSessionBeClosed = true;
       mustSessionBeFlushed = true;
       mustConnectionBeClosed = false;
       } else {
       log.debug("creating hibernate session");
       session = getSessionFactory().openSession();
       mustSessionBeClosed = true;
       mustSessionBeFlushed = true;
       mustConnectionBeClosed = false;
       }
       if (isTransactionEnabled) {
       beginTransaction();
       }
      

      if i change above code to this , the problem solved
      if (isCurrentSessionEnabled) {
      og.debug("creating hibernate session");
      
       session = getSessionFactory().openSession();
       mustSessionBeClosed = true;
       mustSessionBeFlushed = true;
       mustConnectionBeClosed = false;
       }
       if (isTransactionEnabled) {
       beginTransaction();
      


      who can answer my question?