2 Replies Latest reply on Jan 30, 2012 10:11 PM by Ricardo Chiriboga

    Problem Bitronix Transaction, Spring, Jbpm5.2

    Ricardo Chiriboga Newbie

      Hi,

       

      Anyone can help me? i have a structure in JBPM 5.2 with Spring, i have to use LocalTaskService to do one global transaction, but when i create a process sometimes  throws this exception and sometimes dont.

       

       

      javax.persistence.PersistenceException: java.lang.NullPointerException

                at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:516)

                at bitronix.tm.BitronixTransaction.fireBeforeCompletionEvent(BitronixTransaction.java:478)

                at bitronix.tm.BitronixTransaction.commit(BitronixTransaction.java:193)

                at bitronix.tm.BitronixTransactionManager.commit(BitronixTransactionManager.java:120)

                at org.springframework.transaction.jta.JtaTransactionManager.doCommit(JtaTransactionManager.java:1009)

                at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)

                at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)

                at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:374)

                at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)

                at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)

                at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)

                at $Proxy43.iniciarProceso(Unknown Source)

                at co.edu.javerianacali.stp.bpm.facade.impl.JbpmFacadeImpl.iniciarProceso(JbpmFacadeImpl.java:59)

                at co.edu.javerianacali.stp.bpm.JbpmIntegrationTest.crearProceso(JbpmIntegrationTest.java:41)

                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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)

                at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

                at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)

                at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

                at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)

                at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:82)

                at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)

                at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)

                at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)

                at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)

                at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)

                at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)

                at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)

                at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)

                at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)

                at org.junit.runners.ParentRunner.run(ParentRunner.java:236)

                at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)

                at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

      Caused by: java.lang.NullPointerException

                at org.drools.marshalling.impl.OutputMarshaller.writeLeftTuple(OutputMarshaller.java:711)

                at org.drools.marshalling.impl.OutputMarshaller.writeLeftTuples(OutputMarshaller.java:557)

                at org.drools.marshalling.impl.OutputMarshaller.writeFactHandles(OutputMarshaller.java:361)

                at org.drools.marshalling.impl.OutputMarshaller.writeSession(OutputMarshaller.java:143)

                at org.drools.marshalling.impl.DefaultMarshaller.marshall(DefaultMarshaller.java:143)

                at org.drools.marshalling.impl.DefaultMarshaller.marshall(DefaultMarshaller.java:126)

                at org.drools.persistence.SessionMarshallingHelper.getSnapshot(SessionMarshallingHelper.java:72)

                at org.drools.persistence.info.SessionInfo.update(SessionInfo.java:84)

                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.hibernate.ejb.event.BeanCallback.invoke(BeanCallback.java:23)

                at org.hibernate.ejb.event.EntityCallbackHandler.callback(EntityCallbackHandler.java:80)

                at org.hibernate.ejb.event.EntityCallbackHandler.preUpdate(EntityCallbackHandler.java:65)

                at org.hibernate.ejb.event.EJB3FlushEntityEventListener.invokeInterceptor(EJB3FlushEntityEventListener.java:41)

                at org.hibernate.event.def.DefaultFlushEntityEventListener.handleInterception(DefaultFlushEntityEventListener.java:330)

                at org.hibernate.event.def.DefaultFlushEntityEventListener.scheduleUpdate(DefaultFlushEntityEventListener.java:270)

                at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:151)

                at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)

                at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)

                at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:49)

                at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1028)

                at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:366)

                at org.hibernate.ejb.AbstractEntityManagerImpl$1.beforeCompletion(AbstractEntityManagerImpl.java:504)

                ... 41 more

        • 1. Re: Problem Bitronix Transaction, Spring, Jbpm5.2
          rodri tes23 Newbie

          Could you share the Spring configuration files that resulted in the above exception ?

          • 2. Re: Problem Bitronix Transaction, Spring, Jbpm5.2
            Ricardo Chiriboga Newbie

            Hi rodri tes23, thank you for answer

             

            This the spring jbpm5 configuration file

             

            <?xml version="1.0" encoding="UTF-8"?>

            <beans xmlns="http://www.springframework.org/schema/beans"

                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"

                      xmlns:util="http://www.springframework.org/schema/util" xmlns:context="http://www.springframework.org/schema/context"

                      xmlns:drools="http://drools.org/schema/drools-spring"

                      default-lazy-init="true"

                      xsi:schemaLocation="

                      http://drools.org/schema/drools-spring http://drools.org/schema/drools-spring.xsd

                      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd

                                http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd

                                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd

                                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd

                                ">

             

             

             

             

                      <bean id="JbpmDataSource" class="bitronix.tm.resource.jdbc.PoolingDataSource"

                                init-method="init" destroy-method="close">

                                <property name="className"

                                          value="bitronix.tm.resource.jdbc.lrc.LrcXADataSource" />

                                <property name="uniqueName" value="jdbc/testDS1" />

                                <property name="maxPoolSize" value="5" />

                                <property name="allowLocalTransactions" value="true" />

                                <property name="driverProperties">

                                          <props>

                                                    <prop key="driverClassName">${jbpm.jdbc.driver}</prop>

                                                    <prop key="url">${jbpm.jdbc.url}</prop>

                                                    <prop key="user">${jbpm.jdbc.user}</prop>

                                                    <prop key="password">${jbpm.jdbc.password}</prop>

                                          </props>

                                </property>

                      </bean>

             

             

             

             

                      <bean id="jbpmEntityManagerFactory"

                                class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">

                                <property name="persistenceUnitName" value="org.jbpm.persistence.jpa"></property>

                                <property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml"></property>

                                <property name="dataSource" ref="JbpmDataSource" />

                                <property name="jpaVendorAdapter">

                                          <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">

                                                    <property name="database" value="ORACLE" />

                                                    <property name="showSql" value="true" />

                                          </bean>

                                </property>

                      </bean>

             

             

                      <drools:kstore id="knowledgeStoreService" />

             

             

                      <drools:kbase id="knowledgeBase">

                                <drools:resources>

                                          <drools:resource type="CHANGE_SET"

                                                    source="

                                                              http://localhost:8080/drools-guvnor/org.drools.guvnor.Guvnor/package/javerianaSTP/LATEST/ChangeSet.xml" />

                                </drools:resources>

                                <drools:configuration>

                                          <drools:multithread enabled="true" max-threads="5" />

                                </drools:configuration>

                      </drools:kbase>

             

             

                      <drools:ksession id="jpaSingleSessionCommandService"

                                type="stateful" kbase="knowledgeBase">

                                <drools:configuration>

                                          <drools:jpa-persistence>

                                                    <drools:transaction-manager ref="transactionManager" />

                                                    <drools:entity-manager-factory ref="jbpmEntityManagerFactory" />

                                          </drools:jpa-persistence>

                                </drools:configuration>

                      </drools:ksession>

             

             

                      <bean class="org.jbpm.task.service.TaskService" id="taskService"  >

                                <constructor-arg ref="jbpmEntityManagerFactory" />

                                <constructor-arg>

                                          <bean class="org.drools.SystemEventListenerFactory"

                                                    factory-method="getSystemEventListener" />

                                </constructor-arg>

                      </bean>

             

             

                      <bean id="taskServiceSession" factory-bean="taskService" scope="prototype"

                                factory-method="createSession">

                                <property name="transactionType" value="local-JTA" />

                      </bean>

             

             

                      <bean class="org.jbpm.task.service.local.LocalTaskService" id="localTaskService"  scope="prototype">

                                <constructor-arg name="taskServiceSession" ref="taskServiceSession" />

                      </bean>

             

             

                      <bean id="defaultJaverianaUserGroupCallbackImpl" class="org.jbpm.task.service.DefaultJaverianaUserGroupCallbackImpl"/>

                      <bean id="userGroupCallbackManager" class="org.jbpm.task.service.UserGroupCallbackManager"

                                factory-method="getInstance" />

                      <bean

                                class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">

                                <property name="targetObject" ref="userGroupCallbackManager" />

                                <property name="targetMethod" value="setCallback" />

                                <property name="arguments">

                                          <list>

                                                    <ref bean="defaultJaverianaUserGroupCallbackImpl"/>

                                          </list>

                                </property>

                      </bean>

             

             

            </beans>