[jbpm-users] [JBoss jBPM] - exception in the last node of the process
daviddev
do-not-reply at jboss.com
Mon Jul 20 11:07:10 EDT 2009
Hi guy,
I have a small problem when I execute a jbpm process within my application.
my process is relatively simple and consists of:
| ----| ----| ----|
| |(signal) |(signal) |(signal)
| start-state --> node1 --> node2 --> node3 --> waiting(state) --> node4 --> waiting (state) --> node5 --> node6 --> end-state
|
node1 and node2: persists some data within my database
node3: send a message to an external appliation through JMS and wait for the reponse (through JMS too)
node4: persists some data in my database and send a message to an external application through JMS message and wait for the reponse (through JMS too)
node5 and node 6: persists some data in my database
the process instance is started in this way (see code below)
| public void startProcess(String processName, Map<String, Object> variables) throws Exception{
|
| JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
|
| try{
| ProcessInstance pInstance = null;
| pInstance = jbpmContext.newProcessInstanceForUpdate( processName );
| pInstance = jbpmContext.getProcessInstanceForUpdate( pInstance.getId() );
|
| Token token = pInstance.getRootToken();
| token.signal();
|
| }catch( JpdlException e ){
| ...
| }catch( Exception e ){
| ...
| }finally{
| jbpmContext.close();
| }
| }
|
all nodes has at the end of the execute() method a call to the leavenode() method
| public void execute(ExecutionContext ctx) throws Exception {
| //my code here
| ctx.leaveNode();
| }
|
when the response from the external application arrives I resume the process (see the code below) in this way
| public void resumeProcess( Long processId ) throws Exception{
| JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
|
| try{
|
| ProcessInstance pInstance = jbpmContext.getProcessInstanceForUpdate( processId );
| pInstance.signal();
|
| }catch( Exception e ){
| String msg = "Impossible to resume process. an error occured during the resuming operation. ";
| log.debug( msg, e );
| throw new Exception( msg, e );
| }finally{
| jbpmContext.close();
| }
|
the process is running well meaning that each node is visited and the process is resumed (in both waiting state) when I received the response to my request through JMS message.
However I get an exception (see below) when leave the last node (i.e. node6) just before the end-state of the process.
| 15:33:07,827 ERROR [JmsServerSession] org.jboss.resource.adapter.jms.inflow.JmsServerSession at 1a68649 failed to commit/rollback
| javax.transaction.RollbackException: [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] [com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted] Can't commit because the transaction is in aborted state
| at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1401)
| at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.commit(BaseTransaction.java:135)
| at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.commit(BaseTransactionManagerDelegate.java:87)
| at org.jboss.resource.adapter.jms.inflow.JmsServerSession$XATransactionDemarcationStrategy.end(JmsServerSession.java:494)
| at org.jboss.resource.adapter.jms.inflow.JmsServerSession.run(JmsServerSession.java:248)
| at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
| at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
| at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:756)
| at java.lang.Thread.run(Unknown Source)
| Caused by: org.hibernate.QueryParameterException: could not locate named parameter [processInstance]
| at org.hibernate.engine.query.ParameterMetadata.getNamedParameterDescriptor(ParameterMetadata.java:75)
| at org.hibernate.engine.query.ParameterMetadata.getNamedParameterExpectedType(ParameterMetadata.java:81)
| at org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:413)
| at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:383)
| at org.jbpm.db.JobSession$DeleteJobsSynchronization.beforeCompletion(JobSession.java:191)
| at com.arjuna.ats.internal.jta.resources.arjunacore.SynchronizationImple.beforeCompletion(SynchronizationImple.java:114)
| at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.beforeCompletion(TwoPhaseCoordinator.java:247)
| at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:86)
| at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)
| at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.commitAndDisassociate(TransactionImple.java:1389)
| ... 8 more
|
If I remove the call to the leaveNode() method in the node6.
I do not have this exception but obviously my process instance is never ended.
I do not understand what wrong in my code.
Could you give me a hand to understand this issue and solve it.
many thanks
regards
DSE
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4244680#4244680
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4244680
More information about the jbpm-users
mailing list