Custom distro got InaccessibleObjectException #12318
Answered
by
laurit
fangjian0423
asked this question in
Q&A
-
Hi team, I have a custom distro, and will use URLClassLoader to load some 3rd libraries dynamically on the bootstrap phase. Given The code snippet like: URL url = file.toURI().toURL();
URLClassLoader.class.getDeclaredMethod("addURL", URL.class);
ADD_URL.setAccessible(true); // got error
addURL().invoke(classLoader, url); I got below error when I use reflection: Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected void java.net.URLClassLoader.addURL(java.net.URL) accessible: module java.base does not "opens java.net" to unnamed module @32f1fafe The workaround is adding a extra startup option I want to ask is there any ways to resolve it in otel-agent self programmatically? Thank you! |
Beta Was this translation helpful? Give feedback.
Answered by
laurit
Sep 23, 2024
Replies: 1 comment
Answer selected by
fangjian0423
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See
opentelemetry-java-instrumentation/muzzle/src/main/java/io/opentelemetry/javaagent/tooling/muzzle/AgentCachingPoolStrategy.java
Lines 90 to 120 in faff2d9