[
https://jira.jboss.org/jira/browse/JBPM-2711?page=com.atlassian.jira.plug...
]
Ronald van Kuijk commented on JBPM-2711:
----------------------------------------
I signalled the active activity:
cie = childInstance.getExecutionsMap();
cin = cie.keySet();
for (String string : cin) {
System.out.println("Execution key" + string);
System.out.println("Execution state " +
childInstance.getExecution(string).getState()) ;
System.out.println("Execution id " +
childInstance.getExecution(string).getId()) ;
executionService.signalExecutionById(childInstance.getExecution(string).getId(),
AbstractServiceDispatcher.SignalState.SUCCESS.getSignalName(), params);
}
(loop since I did not know what activity was active)
If you have no timer, it could be that the root execution (process instance) is active,
and signalling works like you do it (I'm not sure, these details are not known to me
yet)
Async is e.g. used for 'transaction demarcation' The api returns while in the
background the node is executed in a new transaction. So you should use it when you need
to. It is not needed to have failover specifically. So if you have just one async and the
rest of the process nodes are normal, when something fails and a rollback is needed, it is
rolled back to the last async node or task/state/custom that is a waitstate. What I get
from your example, you want everything to be started automatically. Async can do this, but
it does not require you to have it on every node.
Regarding the timer, no you can leave the duedate on. The real jobscheduler does a query
with e.g. duedate<now(), but the queries shown above ignores them and just executes
them, so instead of in 1 minute or more, your test runs in just 5 seconds.
Subprocess waiting at <state> or <custom> throws
JbpmException 'is not active: inactive-scope' even though isActive() returns true
and findActiveActivityNames() returns the correct active state activity - Addition of
<timer> on transition seems the cause.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Key: JBPM-2711
URL:
https://jira.jboss.org/jira/browse/JBPM-2711
Project: jBPM
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 4.3
Environment: Eclipse 3.5, Oracle 11g, jBPM 4.3 & jBPM 4.2
Reporter: Martin Porter
Attachments: jira-jbpm2711.zip
I have a sub-process that is waiting at a <state> activity. If I attempt to signal
that activity using the subprocess id I get an exception with 'inactive scope'.
Below is the code I am using to signal the activity and also the output (system.out) to
show the status:-
ProcessDefinition childProcessDefinition =
repositoryService.createProcessDefinitionQuery().processDefinitionKey("org.jbpm.examples.subprocess.usecase.waitstate.child").uniqueResult();
ProcessInstanceQuery query =
executionService.createProcessInstanceQuery().processDefinitionId(childProcessDefinition.getId());
ProcessInstance childInstance = query.uniqueResult();
System.out.println("Found Child Process Instance With Id [" +
childInstance.getId() + "]");
System.out.println("Is Active ? " + childInstance.isActive("Business
Service Response Handler"));
System.out.println("State = " + childInstance.getState());
Set<String> activities = childInstance.findActiveActivityNames();
for (String activity : activities) {
System.out.println("Active Activity = " + activity);
}
executionService.signalExecutionById(childInstance.getId(),
AbstractServiceDispatcher.SignalState.SUCCESS.getSignalName(), params);
And here follows the output & stack trace:-
Found Child Process Instance With Id
[org.jbpm.examples.subprocess.usecase.waitstate.child.30020]
Is Active ? true
State = inactive-scope
Active Activity = Business Service Response Handler
11:25:30,862 FIN | [ExecuteActivity]
execution[org.jbpm.examples.subprocess.usecase.waitstate.child.30020.Business Service
Response Handler] executes activity(Business Service Response Handler)
11:25:30,862 FIN | [ExecuteJobCmd] executed job ExecuteActivityMessage[30054]
11:25:30,862 FIN | [HibernateSessionResource] ----- committing hibernate tx
10796546 -------------------------------------------------------
11:25:32,828 FIN | [HibernateSessionResource] ----- beginning hibernate tx 11998234
--------------------------------------------------------
11:25:32,828 FIN | [HibernateSessionResource] ----- committing hibernate tx 32888473
-------------------------------------------------------
11:25:32,828 FIN | [HibernateSessionResource] ----- beginning hibernate tx 21290107
--------------------------------------------------------
11:25:32,829 FIN | [HibernateSessionResource] ----- committing hibernate tx 22589165
-------------------------------------------------------
Found Child Process Instance With Id
[org.jbpm.examples.subprocess.usecase.waitstate.child.30020]
11:25:32,829 FIN | [HibernateSessionResource] ----- beginning hibernate tx 23590079
--------------------------------------------------------
### EXCEPTION ###########################################
11:25:32,829 INF | [DefaultCommandService] exception while executing command
org.jbpm.pvm.internal.cmd.SignalCmd@88e83d
org.jbpm.api.JbpmException:
execution[org.jbpm.examples.subprocess.usecase.waitstate.child.30020] is not active:
inactive-scope
at org.jbpm.pvm.internal.model.ExecutionImpl.checkActive(ExecutionImpl.java:1024)
at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:411)
at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:61)
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.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
at
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
at
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
at
org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:92)
at
org.jbpm.examples.subprocess.usecase.waitstate.SimpleSubflowUsecaseWaitStateTest.testSimpleSubflowRequestRetryThenSkipStepThenEndSuccess(SimpleSubflowUsecaseWaitStateTest.java:700)
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 junit.framework.TestCase.runTest(TestCase.java:164)
at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
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)
### EXCEPTION ###########################################
11:25:32,829 FIN | [HibernateSessionResource] ----- rolling back hibernate tx 4657294
-----------------------------------------------------
11:25:32,829 SEV | [BaseJbpmTestCase]
### EXCEPTION ###########################################
11:25:32,829 SEV | [BaseJbpmTestCase] TEST THROWS EXCEPTION:
execution[org.jbpm.examples.subprocess.usecase.waitstate.child.30020] is not active:
inactive-scope
org.jbpm.api.JbpmException:
execution[org.jbpm.examples.subprocess.usecase.waitstate.child.30020] is not active:
inactive-scope
at org.jbpm.pvm.internal.model.ExecutionImpl.checkActive(ExecutionImpl.java:1024)
at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:411)
at org.jbpm.pvm.internal.cmd.SignalCmd.execute(SignalCmd.java:61)
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.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
at
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
at
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
at
org.jbpm.pvm.internal.svc.ExecutionServiceImpl.signalExecutionById(ExecutionServiceImpl.java:92)
at
org.jbpm.examples.subprocess.usecase.waitstate.SimpleSubflowUsecaseWaitStateTest.testSimpleSubflowRequestRetryThenSkipStepThenEndSuccess(SimpleSubflowUsecaseWaitStateTest.java:700)
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 junit.framework.TestCase.runTest(TestCase.java:164)
at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:80)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
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)
### EXCEPTION ###########################################
11:25:32,829 SEV | [BaseJbpmTestCase]
If I remove the <timer> from the transition all works as expected. I also made a
change the jbpm4.3.xsd to allow the timer to be added to the transition of a
<custom> node in the same way as for <state> (see
http://community.jboss.org/message/518116#518116 ). The result was the same that timers
worked but the signalling fails and removing the <timer> allows the signalling to
work again.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira