AnsweredAssumed Answered

Strange behavior Deploy and Start Process

Question asked by pedrog1 on May 29, 2012
Latest reply on Jun 1, 2012 by pedrog1
I'm having a strange behavior in my app.

When I reboot my application do I have to redeploy the process definitions? It doesn't make any sense for me, but I try to explain why.

Imagine I've just deployed Activiti. I start my application and upload a process definition

public void deployProcess(string resourceName, InputStream inputStream)
   DeploymentBuilder deploymentBuilder = repositoryService.createDeployment();
   deploymentBuilder.name(resourceName);
   deploymentBuilder.addInputStream(resourceName, inputStream);
   deploymentBuilder.deploy();
}
Everything went well. It was deployed and successful parsed.
Then I create a process instance

private void startProcess(String businessKey, String processDefinitionKey) {
   runtimeService.startProcessInstanceByKey(processDefinitionKey, businessKey);
}
It works nicely. I can create as many as I want, complete the task, and so on. No problem till now!

Then I shutdown my app and start it again.
Since I have already deployed the process definition (I can see it in the DB), I can create process instances with it, right?
But when I do

private void startProcess(String businessKey, String processDefinitionKey) {
   runtimeService.startProcessInstanceByKey(processDefinitionKey, businessKey);
}
It gives me this error:

May 29, 2012 6:11:37 PM org.activiti.engine.impl.interceptor.CommandContext close
SEVERE: Error while closing command context
org.springframework.transaction.TransactionSystemException: JTA failure on resume; nested exception is bitronix.tm.internal.BitronixSystemException: cannot resume a Bitronix Transaction with GTRID [7669616E6F6269732D636C75737465722D6E6F646530000001379994D54500001B7C], status=ACTIVE, 1 resource(s) enlisted (started Tue May 29 18:11:37 WEST 2012), error=XAER_DUPID
   at org.springframework.transaction.jta.JtaTransactionManager.doResume(JtaTransactionManager.java:949)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.resume(AbstractPlatformTransactionManager.java:624)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.cleanupAfterCompletion(AbstractPlatformTransactionManager.java:1017)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:804)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:147)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.db.DbIdGenerator.getNewBlock(DbIdGenerator.java:42)
   at org.activiti.engine.impl.db.DbIdGenerator.getNextId(DbIdGenerator.java:34)
   at org.activiti.engine.impl.db.DbSqlSession.insert(DbSqlSession.java:104)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.insert(ExecutionEntity.java:1029)
   at org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.newProcessInstance(ProcessDefinitionEntity.java:137)
   at org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl.createProcessInstanceForInitial(ProcessDefinitionImpl.java:58)
   at org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl.createProcessInstance(ProcessDefinitionImpl.java:48)
   at org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.createProcessInstance(ProcessDefinitionEntity.java:67)
   at org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity.createProcessInstance(ProcessDefinitionEntity.java:126)
   at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:66)
   at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:31)
   at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
   at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:42)
   at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33)
   at org.activiti.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:50)

The strange thing is, if I do this:

//Creates a new deployment, empty! Don't know why, but if not, creating a new process instance will not work!
repositoryService.createDeployment().deploy();

I can then create new process instances and do things normally.

Thanks in advance.

Outcomes