Results 1 to 4 of 4

Thread: Jbpm: Session closed twice?

  1. #1
    Join Date
    Aug 2004
    Posts
    2,715

    Question 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. #2
    Join Date
    Aug 2004
    Posts
    2,715

    Default

    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

  3. #3
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    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.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  4. #4
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    I've just commited an update.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •