RFR: 8160950 Agent JAR added to app class loader rather than system class loader when running with -Djava.system.class.loader
Mandy Chung
mandy.chung at oracle.com
Thu Sep 8 21:55:26 UTC 2016
> On Sep 7, 2016, at 12:27 PM, serguei.spitsyn at oracle.com wrote:
>
> Webrev:
> http://cr.openjdk.java.net/~sspitsyn/webrevs/2016/jdk/8160950-JLI-WLS.jdk2/
CustomLoader.java
62 File f = new File(System.getProperty("test.classes", "."), "Agent.class”);
CustomLoader should load Agent.class from Agent.jar that was added after appendToClassPathForInstrumentation is called.
Agent.java
43 public static void
44 premain(String agentArgs, Instrumentation instrumentation) {
Nit: maybe merge two lines and rename “instrumentation” variable to inst, if you want to shorten the line.
The test needs @modules java.instrument; otherwise the test will fail when running in a minimal image without java.instrument module.
I like David’s suggestion on the simplified error message:
"Unable to add %s to system class path\n”
Mandy
More information about the serviceability-dev
mailing list