Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8139368

-javaagent and -Dcom.sun.management need to add to the initial set of modules to resolve

XMLWordPrintable

    • svc
    • b138

      Consider the following:

      $ java -javaagent:agent.jar -m foo

      *** java.lang.instrument ASSERTION FAILED ***: "!errorOutstanding" with message find class on InstrumentationImpl failed at JPLISAgent.c line: 491
      *** java.lang.instrument ASSERTION FAILED ***: "result" at JPLISAgent.c line: 400
      FATAL ERROR in native method: processing of -javaagent failed

      and also this example:

      $ java -Dcom.sun.management.jmxremote.port=5000 -limitmods foo -m foo
      Error occurred during initialization of VM
      Management agent initialization failure: class sun.management.Agent not found

      With the -javaagent example then the issue is that the java.instrument module is not in the module graph. It can be worked around by adding "-addmods java.instrument" to the command line.

      In the second example then the issue is that the java.management module is not in the module graph. It can be worked around by ensuring that the module java.management is resolved.

      The handling of these options is in arguments.cpp and we need to have these options add to (or create) the system property jdk.launcher.addmods.

      In the case of -javaagent then it needs to add java.instrument to the list of modules in the jdk.launcher.addmods value.

      In the case of -Dcom.sun.management then it needs to add java.management to the list of modules in the jdk.launcher.addmods value.

            akulyakh Alexander Kulyakhtin (Inactive)
            alanb Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: