RFR: 8160950 Agent JAR added to app class loader rather than system class loader when running with -Djava.system.class.loader
David Holmes
david.holmes at oracle.com
Thu Sep 8 07:43:45 UTC 2016
On 8/09/2016 5:38 PM, Alan Bateman wrote:
> On 08/09/2016 08:22, David Holmes wrote:
>> Hi Serguei,
>>
>> On 8/09/2016 5:27 AM, serguei.spitsyn at oracle.com wrote:
>>> Please, review the fix for:
>>> https://bugs.openjdk.java.net/browse/JDK-8160950
>>>
>>> Webrev:
>>>
>>> http://cr.openjdk.java.net/~sspitsyn/webrevs/2016/jdk/8160950-JLI-WLS.jdk2/
>>>
>>>
>>>
>>> Summary:
>>> When running a java application with the options
>>> `-javaagent:myagent.jar -Djava.system.classloader=MyClassLoader`
>>> then the myagent.jar is added to the application class loader rather
>>> than the custom system class loader.
>>
>> I'm confused, the "system" class loader is the "application" class
>> loader.
> You can configure a system property to run with a custom system class
> loader (details in the ClassLoader javadoc). It's rarely used which is
> why this bug has been around for so long and nobody noticed. When you do
> run with a custom system class loader then it means you startup with 4
> class loaders (system, application, platform, boot).
I'd overlooked that the default system loader is used as the parent of
the custom system loader. But it will be very confusing if you refer to
the built-in loader as the "application" loader because the
"application" loader and the "system" loader have always been
synonymous: the loader that loads the application main class.
Thanks,
David
> -Alan
More information about the serviceability-dev
mailing list