AnsweredAssumed Answered

activiti-osgi classloader issue

Question asked by workflowuser2 on Jul 17, 2012
Latest reply on Oct 6, 2013 by rahulkrs
Hi,

I have two bundles :
activiti-osgi-karaf: configures and starts process engine (depends on activiti-osgi)
activiti-osgi-process: contains process.bpmn20.xml, java delegates, process-request bean

reference: activiti-in-action book. java delegates are binded into osgi container as service

process-request bean is a java bean I pass into process variables map:
Map<String, Object> params = new HashMap<String, Object>();
params.put("request", new ProcessRequestBean());
processEngine.getRuntimeService().startProcessInstanceByKey(
            "process", params);

Now, when I try to access ProcessRequestBean into a java delegate:

ProcessRequestBean testPayload = (ProcessRequestBean) execution.getVariable("request");

===
The above works for service tasks.
However, if I put activiti:async="true" in the service task definition, I get the following exception:

Exception in thread "pool-13-thread-3" org.activiti.engine.ActivitiException: coudn't deserialize object in variable 'request'
   at org.activiti.engine.impl.variable.SerializableType.getValue(SerializableType.java:60)
   at org.activiti.engine.impl.persistence.entity.VariableInstanceEntity.getValue(VariableInstanceEntity.java:158)
   at org.activiti.engine.impl.persistence.entity.VariableScopeImpl.getVariable(VariableScopeImpl.java:93)
   at com.acme.workflow.delegates.MyDelegate.execute(DiscoveryHandler.java:20)
   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 org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:50)
   at org.apache.aries.proxy.impl.DefaultWrapper.invoke(DefaultWrapper.java:31)
   at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:78)
   at $Proxy67.execute(Unknown Source)

It appears to be classpath/loader issue. In the osgi env, I believe that both engine and process bundles class loaders should be available.

Any help is greatly appreciated.
Activiti newbie

Outcomes