-
Notifications
You must be signed in to change notification settings - Fork 157
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
Support context class loader in NativeRuntime's closureManager #51
Comments
I was able to work around this issue by doing the following: ClosureManager closureManager = NativeRuntime.getInstance().getClosureManager();
val classLoader = findField(closureManager.getClass(), "classLoader");
classLoader.setAccessible(true);
val asmClassLoader = classLoader.get(closureManager);
val parent = findField(asmClassLoader.getClass(), "parent");
parent.setAccessible(true);
parent.set(asmClassLoader, Thread.currentThread().getContextClassLoader()); |
this means when we switch to the context classloader that in OSGi case it can not find its classes since OSGi does not work with context classloader at all. but probably you are right in the respect that |
That would be a better default. Also, would it be possible to make this configurable maybe? |
See contributed test case in #55. |
Is there any update on this issue? I was trying to use jnr related java library in clojure and when i run the project with boot-clj build tool, it fails to load the class with:
This is because, boot-clj runs 'boot-tasks' in 'pods', which are clojure runtimes in single JVM. They are separated by different classloaders and thus the dependencies are tied to these different classloaders. The System ClassLoader does not have any libraries in the classpath and as a result, it fails to load the class. |
will have look into this first thing next year :) |
Let's try fixing this with |
I've pushed a fix and will release 2.1.3 shortly. |
This is not enough for OSGi running jnr as bundle, when a closure defines a return type with a Class defined in another bundle. For example: BundleA > BundleJNR (BundleA depends on BundleJNR) a callback on BundleA with a return type ClassA, being ClassA a class on BundleA. JNR tries to load ClassA with the classloader of BundleJNR and fails to do it. |
Has this issue been resolved for OSGi? I'm trying to use JavaFS which relies on this library and I continue to get The activate method has thrown an exception
|
In some circumstances it would be useful to replace:
with
A good example is with Spring Boot's nested jars which have the following restriction:
Please see http://www.javaworld.com/article/2077344/core-java/find-a-way-out-of-the-classloader-maze.html for a good discussion of this.
The text was updated successfully, but these errors were encountered: