[
https://jira.jboss.org/jira/browse/JBPM-2529?page=com.atlassian.jira.plug...
]
Christian Bonami updated JBPM-2529:
-----------------------------------
Description:
jBPM-Spring integration works for <custom /> activities (ActivityBehaviour,
ExternalActivityBehaviour).
But registration of EventListener-implementations with Spring doesn't work yet. Take a
look:
<?xml version="1.0" encoding="UTF-8"?>
<process name="test"
xmlns="http://jbpm.org/4.0/jpdl">
<start g="38,16,48,48" name="start">
<transition g="-25,-18" name="to a" to="a" />
</start>
<state g="16,96,92,52" name="a">
<on event="start">
<event-listener expr="${simpleListener}" />
</on>
<transition g="-46,-18" name="to service"
to="service" />
</state>
<custom name="service" g="16,180,92,52"
expr="${executeServiceAndWaitState}">
<transition name="to end" to="end" g="-39,-18"
/>
</custom>
<end g="38,264,48,48" name="end" />
</process>
and
@Component("simpleListener")
public class SimpleListener implements EventListener{
private static final long serialVersionUID = -3904780616247094815L;
@Override
public void notify(EventListenerExecution execution) throws Exception {
System.out.println(">>>>SimpleListener caught event -
execution="+execution.getId());
}
}
@Component("executeServiceAndWaitState")
public class ExecuteServiceAndWaitState implements ExternalActivityBehaviour {
private static final long serialVersionUID = 5989768864384356423L;
@Autowired
private EchoService echoService;
@Override
public void execute(ActivityExecution execution) throws Exception {
System.out.println(this.echoService.echo("ExecuteServiceAndWait.execute(..)"));
execution.waitForSignal();
}
@Override
public void signal(ActivityExecution execution, String signalName,
Map<String, ?> parameters) throws Exception {
System.out.println(this.echoService.echo("ExecuteServiceAndWait.signal(..)"));
}
}
When I omit the event definition from the jPDL and execute it, everything works as
expected.
However, when I leave it in, I get a NullPointerException:
9/8/09 6:56:09 PM (F) Jdk14Log.debug : executing activity(start)
9/8/09 6:56:09 PM (I) Jdk14Log.info : exception while executing command
org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd@2d34ab9b
java.lang.NullPointerException
at
org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:81)
at
org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
at
org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597)
at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:201)
at
org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:65)
at
org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:38)
at
org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at
org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
at
org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:77)
at
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at
org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:66)
at
org.rjv.ambi.kas.process.FindExecutionTest.testFindExecutionById(FindExecutionTest.java:15)
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:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
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)
Note: I make use of the JOTM jtaTransactionmanager, and not the
hibernateTransactionManager, but I don't think that this has nything to do with it.
The code fails on line "eventListener.notify(execution);" in the following code
snippet:
...
public void perform(ExecutionImpl execution) {
EventImpl event = execution.getEvent();
ObservableElementImpl observableElement = event.getObservableElement();
int eventListenerIndex = execution.getEventListenerIndex();
List<EventListenerReference> eventListenerReferences =
event.getListenerReferences();
if ( (eventListenerReferences!=null)
&& (!eventListenerReferences.isEmpty())
) {
EventListenerReference eventListenerReference =
eventListenerReferences.get(eventListenerIndex);
ObservableElement eventSource = execution.getEventSource();
if ((eventSource == observableElement) ||
(eventListenerReference.isPropagationEnabled())) {
EventListener eventListener = eventListenerReference.get();
log.trace("executing " + eventListener + " for " + event);
try {
// TODO can/should this invocation be unified with the exception handler
invocation of the event notification method?
eventListener.notify(execution);
} catch (Exception e) {
log.trace("exception during action: " + e);
execution.handleException((ObservableElementImpl) observableElement, event,
eventListenerReference, e, "couldn't run action " + eventListener);
}
}
// increment the event listener index
eventListenerIndex++;
execution.setEventListenerIndex(eventListenerIndex);
}
...
There's a null-eventListener. I checked this with Andries Inze and he also thinks this
is a bug.
was:
jBPM-Spring integration works for <custom /> activities (ActivityBehaviour,
ExternalActivityBehaviour).
But registration of EventListener-implementations with Spring doesn't work yet. Take a
look:
<?xml version="1.0" encoding="UTF-8"?>
<process name="test"
xmlns="http://jbpm.org/4.0/jpdl">
<start g="38,16,48,48" name="start">
<transition g="-25,-18" name="to a" to="a" />
</start>
<state g="16,96,92,52" name="a">
<on event="start">
<event-listener expr="${simpleListener}" />
</on>
<transition g="-46,-18" name="to service"
to="service" />
</state>
<custom name="service" g="16,180,92,52"
expr="${executeServiceAndWaitState}">
<transition name="to end" to="end" g="-39,-18"
/>
</custom>
<end g="38,264,48,48" name="end" />
</process>
and
@Component("simpleListener")
public class SimpleListener implements EventListener{
private static final long serialVersionUID = -3904780616247094815L;
@Override
public void notify(EventListenerExecution execution) throws Exception {
System.out.println(">>>>SimpleListener caught event -
execution="+execution.getId());
}
}
@Component("executeServiceAndWaitState")
public class ExecuteServiceAndWaitState implements ExternalActivityBehaviour {
private static final long serialVersionUID = 5989768864384356423L;
@Autowired
private EchoService echoService;
@Override
public void execute(ActivityExecution execution) throws Exception {
System.out.println(this.echoService.echo("ExecuteServiceAndWait.execute(..)"));
execution.waitForSignal();
}
@Override
public void signal(ActivityExecution execution, String signalName,
Map<String, ?> parameters) throws Exception {
System.out.println(this.echoService.echo("ExecuteServiceAndWait.signal(..)"));
}
}
When I omit the event definition from the jPDL and execute it, everything works as
expected.
However, when I leave it in, I get a NullPointerException:
9/8/09 6:56:09 PM (F) Jdk14Log.debug : executing activity(start)
9/8/09 6:56:09 PM (I) Jdk14Log.info : exception while executing command
org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd@2d34ab9b
java.lang.NullPointerException
at
org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:81)
at
org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
at
org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597)
at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:201)
at
org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:65)
at
org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:38)
at
org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at
org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
at
org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:77)
at
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at
org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:66)
at
org.rjv.ambi.kas.process.FindExecutionTest.testFindExecutionById(FindExecutionTest.java:15)
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:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
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)
Merk op: ik gebruik de JOTM jtaTransactionmanager, ipv die van Hibernate zelf, maar ik
denk dat dat er niet veel toe doet, want dan zou het voor de executeServiceAndWaitState
ook niet lukken.
Het is de volgende lijn die faalt:
...
public void perform(ExecutionImpl execution) {
EventImpl event = execution.getEvent();
ObservableElementImpl observableElement = event.getObservableElement();
int eventListenerIndex = execution.getEventListenerIndex();
List<EventListenerReference> eventListenerReferences =
event.getListenerReferences();
if ( (eventListenerReferences!=null)
&& (!eventListenerReferences.isEmpty())
) {
EventListenerReference eventListenerReference =
eventListenerReferences.get(eventListenerIndex);
ObservableElement eventSource = execution.getEventSource();
if ((eventSource == observableElement) ||
(eventListenerReference.isPropagationEnabled())) {
EventListener eventListener = eventListenerReference.get();
log.trace("executing " + eventListener + " for " + event);
try {
// TODO can/should this invocation be unified with the exception handler
invocation of the event notification method?
eventListener.notify(execution);
} catch (Exception e) {
log.trace("exception during action: " + e);
execution.handleException((ObservableElementImpl) observableElement, event,
eventListenerReference, e, "couldn't run action " + eventListener);
}
}
// increment the event listener index
eventListenerIndex++;
execution.setEventListenerIndex(eventListenerIndex);
}
...
There's a null-eventListener. I checked this with Andries Inze and he also thinks this
is a bug.
jBPM-Spring Integration doesn't work for EvenListener-s
-------------------------------------------------------
Key: JBPM-2529
URL:
https://jira.jboss.org/jira/browse/JBPM-2529
Project: jBPM
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 4.1
Environment: jBPM 4.1, Java 6, JOTM, Spring 2.5.6, OSX Snow Leopard
Reporter: Christian Bonami
Fix For: jBPM 4.x
jBPM-Spring integration works for <custom /> activities (ActivityBehaviour,
ExternalActivityBehaviour).
But registration of EventListener-implementations with Spring doesn't work yet. Take
a look:
<?xml version="1.0" encoding="UTF-8"?>
<process name="test"
xmlns="http://jbpm.org/4.0/jpdl">
<start g="38,16,48,48" name="start">
<transition g="-25,-18" name="to a" to="a"
/>
</start>
<state g="16,96,92,52" name="a">
<on event="start">
<event-listener expr="${simpleListener}" />
</on>
<transition g="-46,-18" name="to service"
to="service" />
</state>
<custom name="service" g="16,180,92,52"
expr="${executeServiceAndWaitState}">
<transition name="to end" to="end" g="-39,-18"
/>
</custom>
<end g="38,264,48,48" name="end" />
</process>
and
@Component("simpleListener")
public class SimpleListener implements EventListener{
private static final long serialVersionUID = -3904780616247094815L;
@Override
public void notify(EventListenerExecution execution) throws Exception {
System.out.println(">>>>SimpleListener caught event -
execution="+execution.getId());
}
}
@Component("executeServiceAndWaitState")
public class ExecuteServiceAndWaitState implements ExternalActivityBehaviour {
private static final long serialVersionUID = 5989768864384356423L;
@Autowired
private EchoService echoService;
@Override
public void execute(ActivityExecution execution) throws Exception {
System.out.println(this.echoService.echo("ExecuteServiceAndWait.execute(..)"));
execution.waitForSignal();
}
@Override
public void signal(ActivityExecution execution, String signalName,
Map<String, ?> parameters) throws Exception {
System.out.println(this.echoService.echo("ExecuteServiceAndWait.signal(..)"));
}
}
When I omit the event definition from the jPDL and execute it, everything works as
expected.
However, when I leave it in, I get a NullPointerException:
9/8/09 6:56:09 PM (F) Jdk14Log.debug : executing activity(start)
9/8/09 6:56:09 PM (I) Jdk14Log.info : exception while executing command
org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd@2d34ab9b
java.lang.NullPointerException
at
org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:81)
at
org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
at
org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:597)
at org.jbpm.pvm.internal.model.ExecutionImpl.start(ExecutionImpl.java:201)
at
org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:65)
at
org.jbpm.pvm.internal.cmd.StartProcessInstanceInLatestCmd.execute(StartProcessInstanceInLatestCmd.java:38)
at
org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at
org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
at
org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
at
org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:77)
at
org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at
org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:66)
at
org.rjv.ambi.kas.process.FindExecutionTest.testFindExecutionById(FindExecutionTest.java:15)
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:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
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)
Note: I make use of the JOTM jtaTransactionmanager, and not the
hibernateTransactionManager, but I don't think that this has nything to do with it.
The code fails on line "eventListener.notify(execution);" in the following code
snippet:
...
public void perform(ExecutionImpl execution) {
EventImpl event = execution.getEvent();
ObservableElementImpl observableElement = event.getObservableElement();
int eventListenerIndex = execution.getEventListenerIndex();
List<EventListenerReference> eventListenerReferences =
event.getListenerReferences();
if ( (eventListenerReferences!=null)
&& (!eventListenerReferences.isEmpty())
) {
EventListenerReference eventListenerReference =
eventListenerReferences.get(eventListenerIndex);
ObservableElement eventSource = execution.getEventSource();
if ((eventSource == observableElement) ||
(eventListenerReference.isPropagationEnabled())) {
EventListener eventListener = eventListenerReference.get();
log.trace("executing " + eventListener + " for " + event);
try {
// TODO can/should this invocation be unified with the exception handler
invocation of the event notification method?
eventListener.notify(execution);
} catch (Exception e) {
log.trace("exception during action: " + e);
execution.handleException((ObservableElementImpl) observableElement, event,
eventListenerReference, e, "couldn't run action " + eventListener);
}
}
// increment the event listener index
eventListenerIndex++;
execution.setEventListenerIndex(eventListenerIndex);
}
...
There's a null-eventListener. I checked this with Andries Inze and he also thinks
this is a bug.
--
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