OK : that was the mistake !
Muchisimas gracias !
Now i have another problem with the java code : the main program keeps a
reference on the current process instance, its root token, etc. When the timer
has fired and the transition has been activated as expected (since it works !),
the persistent state seems broken, and an exception is thrown, chen the context
is closed...
How the main java program can protected itself from external changes like
timers execution ?
Here the partial stack trace :
| org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate
session
| at
org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:171)
| at org.jbpm.svc.Services.close(Services.java:211)
| at org.jbpm.JbpmContext.close(JbpmContext.java:141)
| at my.wf.five.Main.main(Main.java:101)
|
... and the java code :
| System.out.println("Starting scheduler...");
| Scheduler scheduler = new Scheduler();
| scheduler.setInterval(5000);
| scheduler.setHistoryMaxSize(50);
| scheduler.start();
| System.out.println("Scheduler started...");
|
| JbpmConfiguration jbpmConfiguration =
JbpmConfiguration.getInstance();
|
| String myProcessDefinitionResourceName = "my/wf/five/BP5.xml";
| ProcessDefinition processDefinition =
ProcessDefinition.parseXmlResource(myProcessDefinitionResourceName);
| JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| jbpmContext.deployProcessDefinition(processDefinition);
| }
| finally {
| jbpmContext.close();
| }
|
| ProcessInstance processInstance = null;
|
| System.out.println("=== Sans timer...");
| jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| processInstance = new
ProcessInstance(processDefinition);
|
| Token token = processInstance.getRootToken();
|
| token.signal();
| jbpmContext.save(processInstance);
| System.out.println("\tapres signal 1 : " +
token.getNode().getFullyQualifiedName());
| }
| finally {
| jbpmContext.close();
| }
|
| jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| Token token = processInstance.getRootToken();
| token.signal();
| jbpmContext.save(processInstance);
| System.out.println("\tapres signal 2 : " +
token.getNode().getFullyQualifiedName());
| }
| finally {
| jbpmContext.close();
| }
|
| jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| Token token = processInstance.getRootToken();
| token.signal();
| jbpmContext.save(processInstance);
| System.out.println("\tapres signal 3 : " +
token.getNode().getFullyQualifiedName());
| }
| finally {
| jbpmContext.close();
| }
|
| System.out.println("=== Avec timer...");
| jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| processInstance = new
ProcessInstance(processDefinition);
|
| Token token = processInstance.getRootToken();
|
| token.signal();
| jbpmContext.save(processInstance);
| System.out.println("\tapres signal 1 : " +
token.getNode().getFullyQualifiedName());
| }
| finally {
| jbpmContext.close();
| }
|
| {
| Thread.sleep(10000);
| Token token = processInstance.getRootToken();
| System.out.println("\tapres sleep 2 : " +
token.getNode().getFullyQualifiedName());
| }
|
| jbpmContext = jbpmConfiguration.createJbpmContext();
| try {
| Token token = processInstance.getRootToken();
| token.signal();
| jbpmContext.save(processInstance);
| System.out.println("\tapres signal 3 : " +
token.getNode().getFullyQualifiedName());
| }
| finally {
| jbpmContext.close();
| }
|
| scheduler.stop();
| System.out.println("OK !!!");
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3949895#3949895
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3949895
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user