You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ode.apache.org by Thomas Steinmetz <th...@gmx.de> on 2008/04/22 16:28:22 UTC

Encountered a problem while modifying the runtime

Hi all,

i got a problem modifying the runtime, i hope someone can help me in this.

What i try to do is the following:
I want to be able to stop the execution of an activity at certain points in
its execution, without affecting other activities of the same process.
This stopped activity can be resumed at a later point in time.

For this I want to use ChannelListener.

One example is:

run()
{
	LinkStatusChannel signal = newChannel(LinkStatusChannel.class);
	LinkStatusChannelListener receiver = new LinkStatusChannelListener(signal)
	{
		private static final long serialVersionUID = 1024111188875L;
		public void linkStatus(boolean value) {
				SSCOPE.this.execute();
		}
		
	};
	object(false, receiver);

	ScopeActivityReady evt = new ScopeActivityReady(... signal, ...);
	getBpelRuntimeContext().getBpelProcess().getEngine().fireEvent(evt);
}

execute()
{
  ScopeActivityExecuting evt = new ScopeActivityExecuting(...);
  getBpelRuntimeContext().getBpelProcess().getEngine().fireEvent(evt);
  ...
}


So this Activity has just this one Listener left. If signaled from outside,
it should continue. (I get the channel via this Event.)


In order to know the BpelRuntimeContextImpl for a process, these are noted.

If I want to signal one activity to continue from outside, I have something
like that:

	runtime.getVPU().inject(new JacobRunnable() {
		private static final long serialVersionUID = 76753611036745L;

		public void run() {
			LinkStatusChannel channel = event.chan;
			channel.linkStatus(true);
			}
	});
	        	
	runtime.execute();


Of course, that is not working, although I absolutely don't see why.

When executing the HelloWorld2 example process i get the following:

22.04.2008 16:07:47
org.apache.ode.bpel.extensions.handler.ActivityEventHandler
Scope_Activity_Ready
FEIN:
Scope_Activity_Ready!0!/process!{http://ode/bpel/unit-test}HelloWorld2-1!2
01!null!251
22.04.2008 16:07:47
org.apache.ode.bpel.extensions.handler.ActivityEventHandler
Scope_Activity_Executing
FEIN:
Scope_Activity_Executing!0!/process!{http://ode/bpel/unit-test}HelloWorld2
-1!201!null!251
DEBUG - GeronimoLog.trace(54) | >>
initializeEndpointReferences(parentScopeId=25
1,partnerLinks=[OPartnerLink#9])
16:07:47,743 DEBUG [BpelProcess] >>
initializeEndpointReferences(parentScopeId=2
51,partnerLinks=[OPartnerLink#9])
ERROR - GeronimoLog.error(108) | Method "run" in class
"org.apache.ode.bpel.runt
ime.ACTIVITYGUARD" threw an unexpected exception.
java.lang.NullPointerException
        at
org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
InstanceDAOImpl.java:264)
        at
org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
java:578)
        at
org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
meContextImpl.java:1032)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
        at
org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
51)
        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
ContextImpl.java:828)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
untimeContextImpl.java:1377)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
ctivity(IncomingMessageHandler.java:516)
        at
org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
geDispatcher.java:117)
        at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
onsumer.java:854)
        at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
xecutor.java:99)
        at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
ecutor.java:166)
        at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
java:117)
        at
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
er.java:26)
        at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
va:44)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:650)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)
16:07:47,790 ERROR [JacobVPU] Method "run" in class
"org.apache.ode.bpel.runtime
.ACTIVITYGUARD" threw an unexpected exception.
java.lang.NullPointerException
        at
org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
InstanceDAOImpl.java:264)
        at
org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
java:578)
        at
org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
meContextImpl.java:1032)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
        at
org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
51)
        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
ContextImpl.java:828)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
untimeContextImpl.java:1377)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
ctivity(IncomingMessageHandler.java:516)
        at
org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
geDispatcher.java:117)
        at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
onsumer.java:854)
        at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
xecutor.java:99)
        at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
ecutor.java:166)
        at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
java:117)
        at
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
er.java:26)
        at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
va:44)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:650)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

Via the event ScopeActivityReady I got the Channel, later signaled the
activity to continue,
what it actually does (at least I got the event ScopeActivityExecuted). 
But now, when trying to invoke the pick activity it fails (I am not blocking
anything at that point in time).

If anyone knows why exactly that does not work or what I did wrong... I
appreciate
every hint, because I'm really lost.

Greetings,
Thomas
-- 
View this message in context: http://www.nabble.com/Encountered-a-problem-while-modifying-the-runtime-tp16824336p16824336.html
Sent from the Apache Ode Dev mailing list archive at Nabble.com.


Re: Encountered a problem while modifying the runtime

Posted by Thomas Steinmetz <th...@gmx.de>.
Hi Alex,


Alex Boisvert-3 wrote:
> 
> We're still missing some of the context here;  it's not clear what your
> getRuntime() does but one thing it shouldn't do is to reuse the same
> BpelRuntimeContext from another thread/transaction.
> 
Yeah, that was exactly what I tried to do...
I just saw that yesterday myself. Until then, I thought that there'd be just
one BpelRuntimeContextImpl per instance. Should have had a closer look
on the interna of the engine. I cared more about the activities runtime
behavior
until then. :)
Sorry to have bothered you with that.



> It looks like you're executing this code from another thread so perhaps
> you
> need to create a new BpelRuntimeContext.  Look at
> PartnerLinkMyRoleImpl.invokeInstance() as a basis for this. Ideally this
> would be encapsulated by the engine (and a specific external event) rather
> than doing all this work outside the engine.
> 
Thanks, I'll try that next. :)

Greetings,
Thomas

-- 
View this message in context: http://www.nabble.com/Encountered-a-problem-while-modifying-the-runtime-tp16824336p16892689.html
Sent from the Apache Ode Dev mailing list archive at Nabble.com.


Re: Encountered a problem while modifying the runtime

Posted by Thomas Steinmetz <th...@gmx.de>.
Hi all,

ok, already found the cause for that specific problem :)

Greetings,
Thomas
-- 
View this message in context: http://www.nabble.com/Encountered-a-problem-while-modifying-the-runtime-tp16824336p17104083.html
Sent from the Apache Ode Dev mailing list archive at Nabble.com.


Re: Encountered a problem while modifying the runtime

Posted by Thomas Steinmetz <th...@gmx.de>.
Hi all,


Matthieu Riou-5 wrote:
> 
> I would guess it's a transaction boundaries problem again. When the timer
> fires it starts a new transaction, reloading the runtime context and the
> Jacob state for the database. It seems that at this point the timer
> channel
> can't be found which probably means that the previous transaction hasn't
> been committed yet as it should.
> 

Yes, that was the problem. I now let these WorkEvents execute in sequence,
so that problem is gone.

Now, if I am not blocking anything, everything works fine (see Example1).


But now, if I am blocking (and after a short period of time unblocking)
every Activity in its state "Ready" (see Example2 for that) the old
WorkEvent finishes, and a new one starts (a TIMER WorkEvent). That
continues, until the first <receive> activity gets executed. This time, I
get the errors shown in the attached pic. I don't see, why that fails again,
as all relevant data was already stored at that point in time, as the TIMER
WorkEvent started after the call of the handleWorkEvent() method from the
previous WorkEvent in the BpelProcess class finished.

I hope someone knows what's going wrong or what's the solution for that.

Thanks in advance,
Thomas




Example1:
------------------------------------------------------------
Handling INVOKE_INTERNAL Work Event for ID: null
New BpelRuntimeContextImpl for ID: 201
<EVENT>
 <EVENT_TYPE> Process_Instantiated </EVENT_TYPE>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Instance_Running </EVENT_TYPE>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Ready </EVENT_TYPE>
 <XPATH> /process </XPATH>
 <SCOPE_ID> 251 </SCOPE_ID>
 <PARENT_SCOPE_ID> null </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Executing </EVENT_TYPE>
 <XPATH> /process </XPATH>
 <SCOPE_ID> 251 </SCOPE_ID>
 <PARENT_SCOPE_ID> null </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Variable_Modification_Event </EVENT_TYPE>
 <ACTIVITY_XPATH> /process/sequence[1]/receive[1] </ACTIVITY_XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
 <VARIABLE_NAME> </execute></payload></message> </VARIABLE_NAME>
 <VARIABLE_XPATH> dummy </VARIABLE_XPATH>
 <VARIABLE_VALUE> <message><payload><execute
xmlns="http://ode/bpel/unit-test.wsdl"
xmlns:ns1="http://ode/bpel/unit-test.wsdl"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">fire
</VARIABLE_VALUE>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executed </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Complete </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executed </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Complete </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1]/assign[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1]/assign[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Variable_Modification_Event </EVENT_TYPE>
 <ACTIVITY_XPATH> /process/sequence[1]/assign[1] </ACTIVITY_XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
 <VARIABLE_NAME> dummy2 </VARIABLE_NAME>
 <VARIABLE_XPATH> /process/variables[1]/variable[2] </VARIABLE_XPATH>
 <VARIABLE_VALUE> <message><payload><initiate
xmlns="http://ode/bpel/unit-test.wsdl">123.0</initiate></payload></message>
</VARIABLE_VALUE>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executed </EVENT_TYPE>
 <XPATH> /process/sequence[1]/assign[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Complete </EVENT_TYPE>
 <XPATH> /process/sequence[1]/assign[1] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1]/invoke[1] </XPATH>
 <SCOPE_ID> 252 </SCOPE_ID>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1]/invoke[1] </XPATH>
 <SCOPE_ID> 252 </SCOPE_ID>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Executed </EVENT_TYPE>
 <XPATH> /process/sequence[1]/invoke[1] </XPATH>
 <SCOPE_ID> 252 </SCOPE_ID>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Complete </EVENT_TYPE>
 <XPATH> /process/sequence[1]/invoke[1] </XPATH>
 <SCOPE_ID> 252 </SCOPE_ID>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[2] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[2] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

Handling MATCHER Work Event for ID: 201
New BpelRuntimeContextImpl for ID: 201
Handling INVOKE_INTERNAL Work Event for ID: null
New BpelRuntimeContextImpl for ID: 202
<EVENT>
 <EVENT_TYPE> Process_Instantiated </EVENT_TYPE>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Instance_Running </EVENT_TYPE>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Ready </EVENT_TYPE>
 <XPATH> /process </XPATH>
 <SCOPE_ID> 253 </SCOPE_ID>
 <PARENT_SCOPE_ID> null </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Executing </EVENT_TYPE>
 <XPATH> /process </XPATH>
 <SCOPE_ID> 253 </SCOPE_ID>
 <PARENT_SCOPE_ID> null </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Variable_Modification_Event </EVENT_TYPE>
 <ACTIVITY_XPATH> /process/sequence[1]/receive[1] </ACTIVITY_XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
 <VARIABLE_NAME> dummy2 </VARIABLE_NAME>
 <VARIABLE_XPATH> /process/variables[1]/variable[1] </VARIABLE_XPATH>
 <VARIABLE_VALUE> <message><payload><initiate
xmlns="http://ode/bpel/unit-test.wsdl">123.0</initiate></payload></message>
</VARIABLE_VALUE>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executed </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Complete </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executed </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Complete </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1]/assign[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1]/assign[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Variable_Modification_Event </EVENT_TYPE>
 <ACTIVITY_XPATH> /process/sequence[1]/assign[1] </ACTIVITY_XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
 <VARIABLE_NAME> dummy3 </VARIABLE_NAME>
 <VARIABLE_XPATH> /process/variables[1]/variable[2] </VARIABLE_XPATH>
 <VARIABLE_VALUE> <message><payload><callback
xmlns="http://ode/bpel/unit-test.wsdl">123.0</callback></payload></message>
</VARIABLE_VALUE>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executed </EVENT_TYPE>
 <XPATH> /process/sequence[1]/assign[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Complete </EVENT_TYPE>
 <XPATH> /process/sequence[1]/assign[1] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1]/invoke[1] </XPATH>
 <SCOPE_ID> 254 </SCOPE_ID>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1]/invoke[1] </XPATH>
 <SCOPE_ID> 254 </SCOPE_ID>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Executed </EVENT_TYPE>
 <XPATH> /process/sequence[1]/invoke[1] </XPATH>
 <SCOPE_ID> 254 </SCOPE_ID>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Complete </EVENT_TYPE>
 <XPATH> /process/sequence[1]/invoke[1] </XPATH>
 <SCOPE_ID> 254 </SCOPE_ID>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[2] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[2] </XPATH>
 <PARENT_SCOPE_ID> 253 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/responder}MagicSessionResponder-1
</PROCESS_NAME>
 <PROCESS_ID> 202 </PROCESS_ID>
</EVENT>

Handling TIMER Work Event for ID: 201
New BpelRuntimeContextImpl for ID: 201
Executing WAITER onTimeout().
Handling INVOKE_INTERNAL Work Event for ID: null
New BpelRuntimeContextImpl for ID: 201
<EVENT>
 <EVENT_TYPE> Variable_Modification_Event </EVENT_TYPE>
 <ACTIVITY_XPATH> /process/sequence[1]/receive[2] </ACTIVITY_XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
 <VARIABLE_NAME> dummy3 </VARIABLE_NAME>
 <VARIABLE_XPATH> /process/variables[1]/variable[3] </VARIABLE_XPATH>
 <VARIABLE_VALUE> <message><payload><callback
xmlns="http://ode/bpel/unit-test.wsdl">123.0</callback></payload></message>
</VARIABLE_VALUE>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executed </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Complete </EVENT_TYPE>
 <XPATH> null </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Executed </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[2] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Complete </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[2] </XPATH>
 <PARENT_SCOPE_ID> 251 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}MagicSessionMain-1
</PROCESS_NAME>
 <PROCESS_ID> 201 </PROCESS_ID>
</EVENT>

and so on
------------------------------------------------------------------------


Example2:
------------------------------------------------------------------------
Handling INVOKE_INTERNAL Work Event for ID: null
New BpelRuntimeContextImpl for ID: 203
<EVENT>
 <EVENT_TYPE> Process_Instantiated </EVENT_TYPE>
 <PROCESS_NAME> {http://ode/bpel/unit-test}HelloWorld2-2 </PROCESS_NAME>
 <PROCESS_ID> 203 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Instance_Running </EVENT_TYPE>
 <PROCESS_NAME> {http://ode/bpel/unit-test}HelloWorld2-2 </PROCESS_NAME>
 <PROCESS_ID> 203 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Scope_Activity_Ready </EVENT_TYPE>
 <XPATH> /process </XPATH>
 <SCOPE_ID> 259 </SCOPE_ID>
 <PARENT_SCOPE_ID> null </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}HelloWorld2-2 </PROCESS_NAME>
 <PROCESS_ID> 203 </PROCESS_ID>
</EVENT>

Handling TIMER Work Event for ID: 203
New BpelRuntimeContextImpl for ID: 203
<EVENT>
 <EVENT_TYPE> Scope_Activity_Executing </EVENT_TYPE>
 <XPATH> /process </XPATH>
 <SCOPE_ID> 259 </SCOPE_ID>
 <PARENT_SCOPE_ID> null </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}HelloWorld2-2 </PROCESS_NAME>
 <PROCESS_ID> 203 </PROCESS_ID>
</EVENT>

Executing WAITER onTimeout().
<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1] </XPATH>
 <PARENT_SCOPE_ID> 259 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}HelloWorld2-2 </PROCESS_NAME>
 <PROCESS_ID> 203 </PROCESS_ID>
</EVENT>

Handling TIMER Work Event for ID: 203
New BpelRuntimeContextImpl for ID: 203
Executing WAITER onTimeout().
<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1] </XPATH>
 <PARENT_SCOPE_ID> 259 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}HelloWorld2-2 </PROCESS_NAME>
 <PROCESS_ID> 203 </PROCESS_ID>
</EVENT>

<EVENT>
 <EVENT_TYPE> Activity_Ready </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 259 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}HelloWorld2-2 </PROCESS_NAME>
 <PROCESS_ID> 203 </PROCESS_ID>
</EVENT>

Handling TIMER Work Event for ID: 203
New BpelRuntimeContextImpl for ID: 203
Executing WAITER onTimeout().
<EVENT>
 <EVENT_TYPE> Activity_Executing </EVENT_TYPE>
 <XPATH> /process/sequence[1]/receive[1] </XPATH>
 <PARENT_SCOPE_ID> 259 </PARENT_SCOPE_ID>
 <PROCESS_NAME> {http://ode/bpel/unit-test}HelloWorld2-2 </PROCESS_NAME>
 <PROCESS_ID> 203 </PROCESS_ID>
</EVENT>

------------------------------------------------------------------------

http://www.nabble.com/file/p17080365/pic.gif 
-- 
View this message in context: http://www.nabble.com/Encountered-a-problem-while-modifying-the-runtime-tp16824336p17080365.html
Sent from the Apache Ode Dev mailing list archive at Nabble.com.


Re: Encountered a problem while modifying the runtime

Posted by Matthieu Riou <ma...@offthelip.org>.
On Tue, Apr 29, 2008 at 5:52 AM, Thomas Steinmetz <th...@gmx.de>
wrote:

>
> Hi all,
>
> since that didn't work, I'm trying another, rather ineffiecent approach.
> Of
> course I encountered some problems again ( :( ) and I don't have a clue,
> what's going wrong.
>
>
> When creating a BpelRuntimeContextImpl I inject an object (RUNNER), that
> keeps this BpelRuntimeContextImpl alive for some time.
>
> public class RUNNER extends BpelJacobRunnable
> {
>        private static final long serialVersionUID = 555136346635L;
>
>
>        public RUNNER()
>        {
>
>        }
>
>        public void run() {
>                if (getBpelRuntimeContext().getVPU().counter < 50)
>                {
>                        instance(RUNNER.this);
>                }
>                else
>                {
>                        instance(new WAITER());
>                }
>        }
>
> }
>
> If nothings seems to happen at that instance (50 conescutive executions of
> that RUNNER object), a WAITER object gets injected. So, whenever the
> execution of one instance stopps at a certain point in the process
> (receive,
> wait and so on) one WAITER object is created.
>
> public class WAITER extends BpelJacobRunnable
> {
>        private static final long serialVersionUID = 65661L;
>
>        public void run() {
>                final TimerResponseChannel timerChannel =
> newChannel(TimerResponseChannel.class);
>                Date dueDate = new Date((System.currentTimeMillis() +
> 1000));
>        getBpelRuntimeContext().registerTimer(timerChannel, dueDate);
>
>        object(false, new TimerResponseChannelListener(timerChannel){
>             private static final long serialVersionUID =
> 3120518305645437327L;
>
>            public void onTimeout() {
>            }
>
>            public void onCancel() {
>            }
>        });
>        }
>
> }
>
> This object should do the same as a wait activity (as it waits for 1
> second
> until the timer fires and restarts a new BpelRuntimeContextImpl).
>
> Now there seem to be some kind of problem (see pictures below, got it when
> executing the MagicSession example).
> I just don't see where these errors come from, as I am effectively doing
> the
> same as some additional wait activities in the process itself would do.
>
> Or is there a conflict with having (for example) one pick activity that
> waits for an incoming message and one WAITER object that waits for 1
> second
> at the same time? So that there are two WorkingEvents that try to start a
> new BpelRuntimeContextImpl, although an older version is still running?
>
> I hope someone knows, where these errors come from.
>

I would guess it's a transaction boundaries problem again. When the timer
fires it starts a new transaction, reloading the runtime context and the
Jacob state for the database. It seems that at this point the timer channel
can't be found which probably means that the previous transaction hasn't
been committed yet as it should.

Matthieu


>
> Greetings,
> Thomas
>
> http://www.nabble.com/file/p16959747/pic1.gif
> --
> View this message in context:
> http://www.nabble.com/Encountered-a-problem-while-modifying-the-runtime-tp16824336p16959747.html
> Sent from the Apache Ode Dev mailing list archive at Nabble.com.
>
>

Re: Encountered a problem while modifying the runtime

Posted by Thomas Steinmetz <th...@gmx.de>.
Hi all,

since that didn't work, I'm trying another, rather ineffiecent approach. Of
course I encountered some problems again ( :( ) and I don't have a clue,
what's going wrong.


When creating a BpelRuntimeContextImpl I inject an object (RUNNER), that
keeps this BpelRuntimeContextImpl alive for some time.

public class RUNNER extends BpelJacobRunnable
{
	private static final long serialVersionUID = 555136346635L;

	
	public RUNNER()
	{

	}
	
	public void run() {
		if (getBpelRuntimeContext().getVPU().counter < 50)
		{
			instance(RUNNER.this);
		}
		else
		{
			instance(new WAITER());
		}
	}
	
}

If nothings seems to happen at that instance (50 conescutive executions of
that RUNNER object), a WAITER object gets injected. So, whenever the
execution of one instance stopps at a certain point in the process (receive,
wait and so on) one WAITER object is created.

public class WAITER extends BpelJacobRunnable
{
	private static final long serialVersionUID = 65661L;
	
	public void run() {
		final TimerResponseChannel timerChannel =
newChannel(TimerResponseChannel.class);
		Date dueDate = new Date((System.currentTimeMillis() + 1000));
        getBpelRuntimeContext().registerTimer(timerChannel, dueDate);

        object(false, new TimerResponseChannelListener(timerChannel){
            private static final long serialVersionUID =
3120518305645437327L;

            public void onTimeout() {
            }

            public void onCancel() {
            }
        });
	}

} 

This object should do the same as a wait activity (as it waits for 1 second
until the timer fires and restarts a new BpelRuntimeContextImpl).

Now there seem to be some kind of problem (see pictures below, got it when
executing the MagicSession example).
I just don't see where these errors come from, as I am effectively doing the
same as some additional wait activities in the process itself would do.

Or is there a conflict with having (for example) one pick activity that
waits for an incoming message and one WAITER object that waits for 1 second
at the same time? So that there are two WorkingEvents that try to start a
new BpelRuntimeContextImpl, although an older version is still running? 

I hope someone knows, where these errors come from.

Greetings,
Thomas

http://www.nabble.com/file/p16959747/pic1.gif 
-- 
View this message in context: http://www.nabble.com/Encountered-a-problem-while-modifying-the-runtime-tp16824336p16959747.html
Sent from the Apache Ode Dev mailing list archive at Nabble.com.


Re: Encountered a problem while modifying the runtime

Posted by Alex Boisvert <bo...@intalio.com>.
Hi Thomas,

We're still missing some of the context here;  it's not clear what your
getRuntime() does but one thing it shouldn't do is to reuse the same
BpelRuntimeContext from another thread/transaction.

It looks like you're executing this code from another thread so perhaps you
need to create a new BpelRuntimeContext.  Look at
PartnerLinkMyRoleImpl.invokeInstance() as a basis for this.   Ideally this
would be encapsulated by the engine (and a specific external event) rather
than doing all this work outside the engine.

Hope we're getting closer this time,
alex


On Wed, Apr 23, 2008 at 3:58 AM, Thomas Steinmetz <th...@gmx.de>
wrote:

>
> Hi,
>
> after doing as Alex advised, I still encounter the same errors.
> (thanks for the hint none the less :) )
>
> No I have this:
>
>        BpelRuntimeContextImpl runtime = getRuntime(event.process_ID);
>
>        Scheduler scheduler =
> runtime._bpelProcess._engine._contexts.scheduler;
>
>                try {
>                        final BpelRuntimeContextImpl runt = runtime;
>
>                        scheduler.execTransaction(new Callable<Void>() {
>                            public Void call() throws Exception {
>
>                                 runt.getVPU().inject(new JacobRunnable() {
>                                     private static final long
> serialVersionUID = 76753611036745L;
>                                            public void run() {
>                                                LinkStatusChannel channel =
> event.chan;
>                                                channel.linkStatus(true);
>                                            }
>                                        });
>
>                                         runt.callExecution();
>                                  return null;
>                                        }
>                        });
>                } catch (ContextException e) {
>                        e.printStackTrace();
>                } catch (Exception e) {
>                        e.printStackTrace();
>                }
>
>
> But I still get this errors (at the bottom of the page).
>
> If I call "channel.linkStatus(true)" from within a running activity (so no
> blocking there), everything just works fine.
>
> If I call it from outside (so the activity was blocked), I encounter these
> errors, although I am using the
> BpelRuntimeContextImpl of the respective process instance.
> The call sendEvent(new ActivityEnabledEvent()); in ACTIVITYGUARD actually
> fails, because finally,
> the method insertBpelEvent() in ProcessInstanceDAOImpl throws an exception,
> although it just adds this event to a List.
>
> I still don't know why that fails at all.
>
> So, once again, I appreciate every further hint, because I'm still
> absolutely lost.
>
>
> Greetings,
> Thomas
>
>
>
>
>
>
>
> ERROR - GeronimoLog.error(108) | Method "run" in class
> "org.apache.ode.bpel.runt
> ime.ACTIVITYGUARD" threw an unexpected exception.
> java.lang.NullPointerException
>        at
> org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
> InstanceDAOImpl.java:264)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
> java:578)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
> )
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
> meContextImpl.java:1039)
>         at
> org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
>        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
>        at
> org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
> 51)
>        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute2(BpelRuntim
> eContextImpl.java:841)
>         at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
> ContextImpl.java:831)
>         at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
> untimeContextImpl.java:1384)
>        at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
> IncomingMessageHandler.java:528)
>        at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
> IncomingMessageHandler.java:517)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(Simpl
> eScheduler.java:179)
>         at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
> ctivity(IncomingMessageHandler.java:516)
>        at
> org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
> geDispatcher.java:117)
>        at
> org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
> onsumer.java:854)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
> xecutor.java:99)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
> ecutor.java:166)
>        at
> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
> java:117)
>        at
> org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
> er.java:26)
>        at
> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
> va:44)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.runTask(ThreadPoolExecutor.java:650)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
> 12:02:03,263 ERROR [JacobVPU] Method "run" in class
> "org.apache.ode.bpel.runtime
> .ACTIVITYGUARD" threw an unexpected exception.
> java.lang.NullPointerException
>        at
> org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
> InstanceDAOImpl.java:264)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
> java:578)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
> )
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
> meContextImpl.java:1039)
>         at
> org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
>        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
>        at
> org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
> 51)
>        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute2(BpelRuntim
> eContextImpl.java:841)
>         at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
> ContextImpl.java:831)
>         at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
> untimeContextImpl.java:1384)
>        at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
> IncomingMessageHandler.java:528)
>        at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
> IncomingMessageHandler.java:517)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(Simpl
> eScheduler.java:179)
>         at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
> ctivity(IncomingMessageHandler.java:516)
>        at
> org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
> geDispatcher.java:117)
>        at
> org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
> onsumer.java:854)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
> xecutor.java:99)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
> ecutor.java:166)
>        at
> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
> java:117)
>        at
> org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
> er.java:26)
>        at
> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
> va:44)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.runTask(ThreadPoolExecutor.java:650)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
> java.lang.RuntimeException: java.lang.NullPointerException
>        at
> org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
> 64)
>         at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute2(BpelRuntim
> eContextImpl.java:841)
>         at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
> ContextImpl.java:831)
>         at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
> untimeContextImpl.java:1384)
>        at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
> IncomingMessageHandler.java:528)
>        at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
> IncomingMessageHandler.java:517)
>        at
> org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(Simpl
> eScheduler.java:179)
>         at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
> ctivity(IncomingMessageHandler.java:516)
>        at
> org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
> geDispatcher.java:117)
>        at
> org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
> onsumer.java:854)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
> xecutor.java:99)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
> ecutor.java:166)
>        at
> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
> java:117)
>        at
> org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
> er.java:26)
>        at
> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
> va:44)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.runTask(ThreadPoolExecutor.java:650)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
>
> Caused by: java.lang.NullPointerException
>         at
> org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
> InstanceDAOImpl.java:264)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
> java:578)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
> )
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
> meContextImpl.java:1039)
>         at
> org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
>        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
>        at
> org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
> 51)
>         ... 18 more
> --
> View this message in context:
> http://www.nabble.com/Encountered-a-problem-while-modifying-the-runtime-tp16824336p16834140.html
> Sent from the Apache Ode Dev mailing list archive at Nabble.com.
>
>

Re: Encountered a problem while modifying the runtime

Posted by Thomas Steinmetz <th...@gmx.de>.
Hi,

after doing as Alex advised, I still encounter the same errors.
(thanks for the hint none the less :) )

No I have this:

	BpelRuntimeContextImpl runtime = getRuntime(event.process_ID);
				
	Scheduler scheduler = runtime._bpelProcess._engine._contexts.scheduler;
				
		try {
			final BpelRuntimeContextImpl runt = runtime;
			
			scheduler.execTransaction(new Callable<Void>() {
			    public Void call() throws Exception {
			    	
			    	runt.getVPU().inject(new JacobRunnable() {
			            private static final long serialVersionUID = 76753611036745L;
				            public void run() {
				            	LinkStatusChannel channel = event.chan;
				            	channel.linkStatus(true);
				            }
				        });
				        	
					runt.callExecution();
		                  return null;
					}
			});
		} catch (ContextException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}


But I still get this errors (at the bottom of the page).

If I call "channel.linkStatus(true)" from within a running activity (so no
blocking there), everything just works fine.

If I call it from outside (so the activity was blocked), I encounter these
errors, although I am using the
BpelRuntimeContextImpl of the respective process instance.
The call sendEvent(new ActivityEnabledEvent()); in ACTIVITYGUARD actually
fails, because finally,
the method insertBpelEvent() in ProcessInstanceDAOImpl throws an exception,
although it just adds this event to a List.

I still don't know why that fails at all.

So, once again, I appreciate every further hint, because I'm still
absolutely lost.


Greetings,
Thomas







ERROR - GeronimoLog.error(108) | Method "run" in class
"org.apache.ode.bpel.runt
ime.ACTIVITYGUARD" threw an unexpected exception.
java.lang.NullPointerException
        at
org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
InstanceDAOImpl.java:264)
        at
org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
java:578)
        at
org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
meContextImpl.java:1039)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
        at
org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
51)
        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute2(BpelRuntim
eContextImpl.java:841)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
ContextImpl.java:831)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
untimeContextImpl.java:1384)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
IncomingMessageHandler.java:528)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
IncomingMessageHandler.java:517)
        at
org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(Simpl
eScheduler.java:179)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
ctivity(IncomingMessageHandler.java:516)
        at
org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
geDispatcher.java:117)
        at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
onsumer.java:854)
        at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
xecutor.java:99)
        at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
ecutor.java:166)
        at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
java:117)
        at
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
er.java:26)
        at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
va:44)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:650)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)
12:02:03,263 ERROR [JacobVPU] Method "run" in class
"org.apache.ode.bpel.runtime
.ACTIVITYGUARD" threw an unexpected exception.
java.lang.NullPointerException
        at
org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
InstanceDAOImpl.java:264)
        at
org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
java:578)
        at
org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
meContextImpl.java:1039)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
        at
org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
51)
        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute2(BpelRuntim
eContextImpl.java:841)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
ContextImpl.java:831)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
untimeContextImpl.java:1384)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
IncomingMessageHandler.java:528)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
IncomingMessageHandler.java:517)
        at
org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(Simpl
eScheduler.java:179)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
ctivity(IncomingMessageHandler.java:516)
        at
org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
geDispatcher.java:117)
        at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
onsumer.java:854)
        at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
xecutor.java:99)
        at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
ecutor.java:166)
        at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
java:117)
        at
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
er.java:26)
        at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
va:44)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:650)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)
java.lang.RuntimeException: java.lang.NullPointerException
        at
org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
64)
        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute2(BpelRuntim
eContextImpl.java:841)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
ContextImpl.java:831)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
untimeContextImpl.java:1384)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
IncomingMessageHandler.java:528)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler$1.call(
IncomingMessageHandler.java:517)
        at
org.apache.ode.scheduler.simple.SimpleScheduler.execTransaction(Simpl
eScheduler.java:179)
        at
org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
ctivity(IncomingMessageHandler.java:516)
        at
org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
geDispatcher.java:117)
        at
org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
onsumer.java:854)
        at
org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
xecutor.java:99)
        at
org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
ecutor.java:166)
        at
org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
java:117)
        at
org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
er.java:26)
        at
org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
va:44)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.runTask(ThreadPoolExecutor.java:650)
        at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
ker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

Caused by: java.lang.NullPointerException
        at
org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
InstanceDAOImpl.java:264)
        at
org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
java:578)
        at
org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
)
        at
org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
meContextImpl.java:1039)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
        at org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
        at
org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
51)
        ... 18 more 
-- 
View this message in context: http://www.nabble.com/Encountered-a-problem-while-modifying-the-runtime-tp16824336p16834140.html
Sent from the Apache Ode Dev mailing list archive at Nabble.com.


Re: Encountered a problem while modifying the runtime

Posted by Alex Boisvert <bo...@intalio.com>.
Hi Thomas,

The data access objects require a transaction context for most operations.
I would advise wrapping your link injection code into a
Scheduler.execTransaction() block,

scheduler.execTransaction(new Callable<Void>() {
    public Void call() throws Exception {
        // your code here
        return null;
    }
});

Hope this helps,
alex


On Tue, Apr 22, 2008 at 7:28 AM, Thomas Steinmetz <th...@gmx.de>
wrote:

>
> Hi all,
>
> i got a problem modifying the runtime, i hope someone can help me in this.
>
> What i try to do is the following:
> I want to be able to stop the execution of an activity at certain points
> in
> its execution, without affecting other activities of the same process.
> This stopped activity can be resumed at a later point in time.
>
> For this I want to use ChannelListener.
>
> One example is:
>
> run()
> {
>        LinkStatusChannel signal = newChannel(LinkStatusChannel.class);
>        LinkStatusChannelListener receiver = new
> LinkStatusChannelListener(signal)
>        {
>                private static final long serialVersionUID =
> 1024111188875L;
>                public void linkStatus(boolean value) {
>                                SSCOPE.this.execute();
>                }
>
>        };
>        object(false, receiver);
>
>        ScopeActivityReady evt = new ScopeActivityReady(... signal, ...);
>
>  getBpelRuntimeContext().getBpelProcess().getEngine().fireEvent(evt);
> }
>
> execute()
> {
>  ScopeActivityExecuting evt = new ScopeActivityExecuting(...);
>  getBpelRuntimeContext().getBpelProcess().getEngine().fireEvent(evt);
>  ...
> }
>
>
> So this Activity has just this one Listener left. If signaled from
> outside,
> it should continue. (I get the channel via this Event.)
>
>
> In order to know the BpelRuntimeContextImpl for a process, these are
> noted.
>
> If I want to signal one activity to continue from outside, I have
> something
> like that:
>
>        runtime.getVPU().inject(new JacobRunnable() {
>                private static final long serialVersionUID =
> 76753611036745L;
>
>                public void run() {
>                        LinkStatusChannel channel = event.chan;
>                        channel.linkStatus(true);
>                        }
>        });
>
>        runtime.execute();
>
>
> Of course, that is not working, although I absolutely don't see why.
>
> When executing the HelloWorld2 example process i get the following:
>
> 22.04.2008 16:07:47
> org.apache.ode.bpel.extensions.handler.ActivityEventHandler
> Scope_Activity_Ready
> FEIN:
> Scope_Activity_Ready!0!/process!{http://ode/bpel/unit-test}HelloWorld2-1!2<http://ode/bpel/unit-test%7DHelloWorld2-1%212>
> 01!null!251
> 22.04.2008 16:07:47
> org.apache.ode.bpel.extensions.handler.ActivityEventHandler
> Scope_Activity_Executing
> FEIN:
> Scope_Activity_Executing!0!/process!{http://ode/bpel/unit-test}HelloWorld2
> -1!201!null!251<http://ode/bpel/unit-test%7DHelloWorld2-1%21201%21null%21251>
> DEBUG - GeronimoLog.trace(54) | >>
> initializeEndpointReferences(parentScopeId=25
> 1,partnerLinks=[OPartnerLink#9])
> 16:07:47,743 DEBUG [BpelProcess] >>
> initializeEndpointReferences(parentScopeId=2
> 51,partnerLinks=[OPartnerLink#9])
> ERROR - GeronimoLog.error(108) | Method "run" in class
> "org.apache.ode.bpel.runt
> ime.ACTIVITYGUARD" threw an unexpected exception.
> java.lang.NullPointerException
>        at
> org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
> InstanceDAOImpl.java:264)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
> java:578)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
> )
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
> meContextImpl.java:1032)
>        at
> org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
>        at
> org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
>        at
> org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
> 51)
>        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
> ContextImpl.java:828)
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
> untimeContextImpl.java:1377)
>        at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
> ctivity(IncomingMessageHandler.java:516)
>        at
> org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
> geDispatcher.java:117)
>        at
> org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
> onsumer.java:854)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
> xecutor.java:99)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
> ecutor.java:166)
>        at
> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
> java:117)
>        at
> org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
> er.java:26)
>        at
> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
> va:44)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.runTask(ThreadPoolExecutor.java:650)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
> 16:07:47,790 ERROR [JacobVPU] Method "run" in class
> "org.apache.ode.bpel.runtime
> .ACTIVITYGUARD" threw an unexpected exception.
> java.lang.NullPointerException
>        at
> org.apache.ode.dao.jpa.ProcessInstanceDAOImpl.insertBpelEvent(Process
> InstanceDAOImpl.java:264)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveInstanceEvent(BpelProcess.
> java:578)
>        at
> org.apache.ode.bpel.engine.BpelProcess.saveEvent(BpelProcess.java:572
> )
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.sendEvent(BpelRunti
> meContextImpl.java:1032)
>        at
> org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:150)
>        at
> org.apache.ode.bpel.runtime.ACTIVITY.sendEvent(ACTIVITY.java:141)
>        at
> org.apache.ode.bpel.runtime.ACTIVITYGUARD.run(ACTIVITYGUARD.java:96)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:585)
>        at
> org.apache.ode.jacob.vpu.JacobVPU$JacobThreadImpl.run(JacobVPU.java:4
> 51)
>        at org.apache.ode.jacob.vpu.JacobVPU.execute(JacobVPU.java:139)
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.execute(BpelRuntime
> ContextImpl.java:828)
>        at
> org.apache.ode.bpel.engine.BpelRuntimeContextImpl.callExecution(BpelR
> untimeContextImpl.java:1377)
>        at
> org.apache.ode.bpel.extensions.handler.IncomingMessageHandler.Start_A
> ctivity(IncomingMessageHandler.java:516)
>        at
> org.apache.ode.bpel.extensions.comm.MessageDispatcher.onMessage(Messa
> geDispatcher.java:117)
>        at
> org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageC
> onsumer.java:854)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionE
> xecutor.java:99)
>        at
> org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionEx
> ecutor.java:166)
>        at
> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.
> java:117)
>        at
> org.apache.activemq.thread.PooledTaskRunner.access$100(PooledTaskRunn
> er.java:26)
>        at
> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.ja
> va:44)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.runTask(ThreadPoolExecutor.java:650)
>        at
> edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Wor
> ker.run(ThreadPoolExecutor.java:675)
>        at java.lang.Thread.run(Thread.java:595)
>
> Via the event ScopeActivityReady I got the Channel, later signaled the
> activity to continue,
> what it actually does (at least I got the event ScopeActivityExecuted).
> But now, when trying to invoke the pick activity it fails (I am not
> blocking
> anything at that point in time).
>
> If anyone knows why exactly that does not work or what I did wrong... I
> appreciate
> every hint, because I'm really lost.
>
> Greetings,
> Thomas
> --
> View this message in context:
> http://www.nabble.com/Encountered-a-problem-while-modifying-the-runtime-tp16824336p16824336.html
> Sent from the Apache Ode Dev mailing list archive at Nabble.com.
>
>