Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Jbpm: Session closed twice? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Jbpm: Session closed twice?

    Currently I try to use spring-jbpm in a transactional context. As I read this should work. Now I face the problem, that the hibernate session opened for the transaction is being closed twice.
    The first invocation.

    This is the stacktrace of the first close attempt:
    Code:
    SessionImpl.close() line: 293
    JbpmSessionFactoryUtils$SpringJbpmSessionSynchronization.afterCompletion(int) line: 90
    HibernateTransactionManager(AbstractPlatformTransactionManager).invokeAfterCompletion(List, int) line: 725
    HibernateTransactionManager(AbstractPlatformTransactionManager).triggerAfterCompletion(DefaultTransactionStatus, int) line: 697
    HibernateTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus) line: 534
    HibernateTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus) line: 469
    TransactionInterceptor(TransactionAspectSupport).doCommitTransactionAfterReturning(TransactionAspectSupport$TransactionInfo) line: 267
    TransactionInterceptor.invoke(MethodInvocation) line: 107
    And this is the second attempt:

    Code:
    SessionImpl.close() line: 293
    SessionFactoryUtils.doClose(Session) line: 772
    SessionFactoryUtils.closeSessionOrRegisterDeferredClose(Session, SessionFactory) line: 760
    SessionFactoryUtils.releaseSession(Session, SessionFactory) line: 733
    HibernateTransactionManager.doCleanupAfterCompletion(Object) line: 657
    HibernateTransactionManager(AbstractPlatformTransactionManager).cleanupAfterCompletion(DefaultTransactionStatus) line: 750
    HibernateTransactionManager(AbstractPlatformTransactionManager).processCommit(DefaultTransactionStatus) line: 537
    HibernateTransactionManager(AbstractPlatformTransactionManager).commit(TransactionStatus) line: 469
    TransactionInterceptor(TransactionAspectSupport).doCommitTransactionAfterReturning(TransactionAspectSupport$TransactionInfo) line: 267
    TransactionInterceptor.invoke(MethodInvocation) line: 107
    An excerpt of my application context is here:
    Code:
    <bean id="adminSvc" class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="proxyInterfaces">
        <list>
            <value>demo.AdminSvc</value>
        </list>
        </property>
    
        <property name="target" ref="adminSvcTarget"/>
    
        <property name="interceptorNames">
        <list>
            <value>adminSvcTxInterceptor</value>
        </list>
        </property>
    </bean>
    
    <bean id="adminSvcTxInterceptor" parent="abstractTxInterceptor">
        <property name="transactionAttributeSource">
            <value>demo.AdminSvc.*=PROPAGATION_REQUIRED</value>
        </property>
    </bean>
    
    <bean id="adminSvcTarget" class="demo.AdminImpl">
        <property name="jbpmHelper" ref="jbpmHelper"/>
    </bean> 
    
    
    
    <bean id="jbpmHelper" class="demo.JbpmHelper">
        <property name="sessionFactory" ref="jbpmSessionFactoryBean"/>
        <property name="processDefinition" ref="processDefinition"/>
    </bean> 
    
    
    <bean id="jbpmSessionFactoryBean" class="org.springframework.workflow.jbpm.LocalJbpmSessionFactoryBean">
        <property name="hibernateSessionFactory" ref="hibernateSessionFactory"/>
    
        <property name="hibernateConfiguration">
            <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="targetObject" ref="&amp;hibernateSessionFactory"/>
        <property name="targetMethod" value="getConfiguration"/>
            </bean>
        </property>
    </bean>
    
    <bean id="processDefinition" class="org.springframework.workflow.jbpm.definition.ProcessDefinitionFactoryBean">
        <property name="jbpmSessionFactory" ref="jbpmSessionFactoryBean"/>
    
        <property name="definitionLocation" value="classpath:/demo-process.xml"/>
        </bean>
    
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="hibernateSessionFactory"/>
    </bean>
    
    <bean id="abstractTxInterceptor" 
        class="org.springframework.transaction.interceptor.TransactionInterceptor"
        abstract="true">
    
        <property name="transactionManager" ref="transactionManager"/>
    </bean>
    The invoked method does this:
    Code:
            final ProcessDefinition pd = this.helper.getProcessDefinition();
            JbpmCallback callback = new JbpmCallback() {
    
                public Object doInJbpm(JbpmSession session) {
                    session.getGraphSession().saveProcessDefinition(pd);
                    return null;
                }
                
            };
            
            this.helper.getJbpmTemplate().execute(callback);
    And for completeness:
    Using Spring 2.0M1, spring-jbpm from cvs, Hibernate 3.1.1 and jBPM 3.0.2

    Any ideas?

    Thanks in advance,
    Andreas

  • #2
    As an addition:
    Since the problem has something to do with transaction synchronization I tried to set the transactionSynchronizationName property of the transaction manager to SYNCHRONIZATION_NEVER. This works. However, I am unsure about probable side effects. So a clean solution would be appreciated.

    Andreas

    Comment


    • #3
      I've created an issue on jira : http://opensource2.atlassian.com/pro.../browse/MOD-78. I think it's a bug ;it might have something to do with hb 3.1.1 - please try with HB 3.0.5.

      Comment


      • #4
        I've just commited an update.

        Comment

        Working...
        X