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
JarHell: Check the parent classloader rather than the system classloader #16726
Comments
There isn't a way to check an arbitrary classloader. If its a URLClassLoader, then you can, but this is not the case anymore since jigsaw. That's why Adding a special hook for running in an OSGI container, e.g. an trying to be even smarter and conditionally do something "only when its a URLClassLoader and we are in a container" is fairly sneaky, but might work. But we have to add this "container detection" logic (which likely needs special privileges for CL.getSystemClassLoader call) during bootstrap and expose it in BootStrapInfo... and somehow know that all this is working properly when we don't test running inside any containers. And there is really no guarantee containers are using URLClassLoaders. |
there is also a setting in 2.2 that allows you to disable jarhell checks for testing |
@s1monw It ends up being bypassed when testing with plugins because the plugin manager bypasses the check. |
@pickypg Not if you construct a Node the new way. In master that would be using the Node constructor directly which takes plugin classes, or on 2.x using MockNode (as our tests do). |
@pickypg is this solving you issue, can we close? |
We do not support embedded Elasticsearch nodes. |
Currently, JarHell checks the system classloader to find issues with jar collisions.
In order to support OSGi environments for testing embedded nodes, it's effectively a requirement that the parent classloader be checked instead.
Pros:
Cons:
The text was updated successfully, but these errors were encountered: