Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing setContextClassLoader #132

Closed
jackybourgeois opened this issue Jan 21, 2015 · 1 comment
Closed

Missing setContextClassLoader #132

jackybourgeois opened this issue Jan 21, 2015 · 1 comment

Comments

@jackybourgeois
Copy link

Hello,

Doing some tests with MOEA framework inside a Kevoree component, I came accross the exception below from the code of an Input port:

java.lang.IllegalArgumentException: interface org.moeaframework.util.progress.ProgressListener is not visible from class loader
at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:580)
at java.lang.reflect.Proxy$ProxyClassFactory.apply(Proxy.java:556)
at java.lang.reflect.WeakCache$Factory.get(WeakCache.java:230)
at java.lang.reflect.WeakCache.get(WeakCache.java:127)
at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:418)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:717)
at org.apache.commons.lang3.event.EventListenerSupport.createProxy(EventListenerSupport.java:277)
at org.apache.commons.lang3.event.EventListenerSupport.initializeTransientFields(EventListenerSupport.java:268)
at org.apache.commons.lang3.event.EventListenerSupport.(EventListenerSupport.java:144)
at org.apache.commons.lang3.event.EventListenerSupport.(EventListenerSupport.java:122)
at org.apache.commons.lang3.event.EventListenerSupport.create(EventListenerSupport.java:106)
at org.moeaframework.util.progress.ProgressHelper.(ProgressHelper.java:104)
at org.moeaframework.Executor.(Executor.java:125)
at org.activehome.library.service.iems.algo.GeneticAlgo.schedule(GeneticAlgo.java:29)
at org.activehome.library.service.iems.ProactiveAdaptation.optimizeSchedule(ProactiveAdaptation.java:77)
at org.activehome.library.service.iems.ProactiveAdaptation.updateSchedule(ProactiveAdaptation.java:101)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.activehome.core.component.AbstractService.getResponse(AbstractService.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.kevoree.library.java.wrapper.port.ProvidedPortImpl.send(ProvidedPortImpl.java:93)
at org.kevoree.library.AsyncBroadcast$1.run(AsyncBroadcast.java:42)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Thanks to François I understood the ClassLoader was the wrong one. It was the one from the component who fired the message (on Output port) instead of the one from the receiver (on Input port).

We set manually the ClassLoader to work around in the Input port method:

Thread.currentThread().setContextClassLoader(MyComponentWhoReceive.class.getClassLoader());

@jackybourgeois jackybourgeois changed the title Missing set Missing setContextClassLoader Jan 21, 2015
@dukeboard
Copy link
Member

Thx Jacky for the report, as planned together this fix will be include in the next rolling release beginning of next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants