JBoss Community

failed to lazily initialize a collection of role: org.jbpm.pvm.internal.model.ExecutionImpl.variables, no session or session was closed

reply from Felix Jose in jBPM - View the full discussion

HI Michael,

 

Thank You for your reply. Even I am having the same configuration in my jbpm.cfg.xml file. Then I have tried with reinstantiate the ExecutionService factory as

 

 

executionService = processEngine.getExecutionService();

Then after that it starts working. Before I give the transaction management I was getting the lazyinitialization exception while trying to access the properties of the jbpm process variable objects. But after I configure the transaction management as follows:

 

 

<bean id="jbpmContextServiceTarget" class="com.collabera.poc.jbpm.impl.JBPMContextServiceImpl"

            init-method="init">

            <property name="processEngine">

                  <ref bean="processEngine" />

            </property>

            <property name="checking">

                  <ref bean="checking" />

            </property>

<bean id="jbpmContextService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">

    <property name="transactionManager"><ref bean="transactionManager"/></property>

    <property name="target"><ref bean="jbpmContextServiceTarget"/></property>

    <property name="transactionAttributes">

        <props>

            <prop key="deploy*">PROPAGATION_REQUIRED</prop>

            <prop key="*">PROPAGATION_REQUIRED</prop>

        </props>

    </property>

</bean>

 

And try to do a transition using executionService  I am getting the exception saying that "

Exception in thread "main"

 

org.jbpm.api.JbpmException: execution ddrRequest.400008 does not exist

at org.jbpm.pvm.internal.cmd.SignalCmd.execute(

 

SignalCmd.java:58)

at org.jbpm.pvm.internal.cmd.SignalCmd.execute(

 

SignalCmd.java:35)

at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(

 

DefaultCommandService.java:42)

at org.jbpm.pvm.internal.tx.SpringCommandCallback.doInTransaction(

 

SpringCommandCallback.java:45)

at org.springframework.transaction.support.TransactionTemplate.execute(

 

TransactionTemplate.java:128)

I am getting this exception when I am using the ExecutionService instance to access the process instance.

In my analysis the problem is as the transaction is active and session is opened the JBPM4_EXECUTION table is not getting updated and the

 

 

 

 

 

 

executionService

 

 

.signalExecutionById(id, "analystResearch"); is trying to find the execution istance from table but it is not present. But my doubt is why it is not tring to pick it from session?

 

One main thing is this problem is occuring only when the JBPM process definition is having a <java> node with some arguments and if we change the variable/variables in that java class.

 

And one more doubt,

 

processEngine.execute(new Command() {
    public Object execute(Environment env) {
        // do something.
        return null;
    }
});
why do we need this?

 

Can anybody please send me a solution for the same.

 

Thank you and regards,

Felix K Jose

Reply to this message by going to Community

Start a new discussion in jBPM at Community