scoped class loading and jbpm.esb
jjarkko Jul 30, 2008 5:55 PMHello,
When deploying .esb-archive with scoped class loading I noticed that it isn't always working very well with JBPM, instead you get ugly ClassCastException.
In the example below TestEsbAction.process is called from JBPM process using org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler
java.lang.ClassCastException: CustomerType cannot be cast to CustomerType at MessageUtil.getCustomerFromMessage(MessageUtil.java:26) at TestEsbAction.process(PerustaAsiakas.java:334) 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.jboss.soa.esb.listeners.message.ActionProcessorMethodInfo.processMethods(ActionProcessorMethodInfo.java:102) at org.jboss.soa.esb.listeners.message.OverriddenActionLifecycleProcessor.process(OverriddenActionLifecycleProcessor.java:74) at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.process(ActionProcessingPipeline.java:316) at org.jboss.soa.esb.listeners.message.MessageAwareListener$TransactionalRunner.run(MessageAwareListener.java:530) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907) at java.lang.Thread.run(Thread.java:619)
CustomerType is inside JAR-file which is in the root of the deployed esb-archive.
If I turn the scoped class loading off this works, but that's something that cannot be done, as we want to be able to have different versions of same classes in other esb deployments).
This gets even more uglier if there's a CustomerType available from non-scoped classloader. If this the case then jbpm.esb will use the class available from the "global" classloader and you get another ClassCastException inside the JBPM process either at or (there's some confusing documentation about the element names) when doing the mappings from bpm to esb.
I think jbpm.esb should use the classloader of the ESB service where the jbpm call initiated. Do you think this would be possible to do? Or am I totally on the wrong track here..