]
Galder Zamarreño resolved ISPN-2841.
------------------------------------
Resolution: Out of Date
DefaultExecutorService: No possibility to set ClassLoader used for
cloning Callables
------------------------------------------------------------------------------------
Key: ISPN-2841
URL:
https://issues.jboss.org/browse/ISPN-2841
Project: Infinispan
Issue Type: Enhancement
Components: Clustered Executor
Affects Versions: 5.2.1.Final
Reporter: Carsten Lohmann
Assignee: Galder Zamarreño
When using the DistributedExecutorService we noticed that the ContextClassLoader of the
current thread is used for cloning the Callable.
But this ClassLoader wasn't able to find the Callable class in our case, so we got
this exception:
{noformat}
org.infinispan.CacheException: java.lang.ClassNotFoundException: [...]Callable
at org.infinispan.util.Util.cloneWithMarshaller(Util.java:259)
at
org.infinispan.distexec.DefaultExecutorService.clone(DefaultExecutorService.java:555)
at
org.infinispan.distexec.DefaultExecutorService.submitEverywhere(DefaultExecutorService.java:510)
at
org.infinispan.distexec.DefaultExecutorService.submitEverywhere(DefaultExecutorService.java:497)
[...]
Caused by: java.lang.ClassNotFoundException: [...]Callable
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at
org.jboss.marshalling.AbstractClassResolver.loadClass(AbstractClassResolver.java:135)
at
org.jboss.marshalling.AbstractClassResolver.resolveClass(AbstractClassResolver.java:116)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadClassDescriptor(RiverUnmarshaller.java:893)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1205)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:272)
at
org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:37)
at
org.infinispan.marshall.jboss.AbstractJBossMarshaller.objectFromObjectStream(AbstractJBossMarshaller.java:163)
at
org.infinispan.marshall.VersionAwareMarshaller.objectFromByteBuffer(VersionAwareMarshaller.java:116)
at
org.infinispan.marshall.AbstractMarshaller.objectFromByteBuffer(AbstractMarshaller.java:106)
at
org.infinispan.marshall.AbstractDelegatingMarshaller.objectFromByteBuffer(AbstractDelegatingMarshaller.java:99)
at org.infinispan.util.Util.cloneWithMarshaller(Util.java:254)
{noformat}
So there should be a possibility to explicitly set the ClassLoader that the
ExecutorService will use for cloning the Callable.
Maybe by using the ClassLoader set via AdvancedCache.with(ClassLoader) on the
AdvancedCache given to the ExecutorService.