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

Odd handling of -XX:-UseAppCDS and -XX:SharedArchiveFile

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 11
    • 9
    • hotspot
    • b12

      While while testing a thing with AppCDS on/off, I found if you just switch to -XX:-UseAppCDS and leave all the other AppCDS options in place, you get an error about
      Error: VM option 'SharedArchiveFile' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.

      which is weird since you dont need explicit +UnlockDiagnosticVMOptions to use AppCDS.

      $ /tmp/jdk/bin/java -Xshare:on -XX:+UnlockCommercialFeatures -XX:SharedArchiveFile=Netty.jsa -XX:+UseAppCDS --add-modules=java.se.ee --upgrade-module-path /home/eric/views/javax.annotation-api-1.2/target/javax.annotation-api-1.2.jar -jar target/jersey-netty-app-1.0-SNAPSHOT.jar
      Jun 22, 2017 4:57:45 PM app.App main
      INFO: Prometheus intializing JVM metrics
      Jun 22, 2017 4:57:45 PM app.App main
      INFO: Netty starting
      WARNING: An illegal reflective access operation has occurred
      WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/home/eric/views/ccc-jersey-netty-app/target/jersey-netty-app-1.0-SNAPSHOT.jar) to constructor java.nio.DirectByteBuffer(long,int)
      WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
      WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
      WARNING: All illegal access operations will be denied in a future release
      Jun 22, 2017 4:57:45 PM app.App main
      INFO: Netty started

      [In the above case the app worked with AppCDS on]


      $ /tmp/jdk/bin/java -Xshare:on -XX:+UnlockCommercialFeatures -XX:SharedArchiveFile=Netty.jsa -XX:-UseAppCDS --add-modules=java.se.ee --upgrade-module-path /home/eric/views/javax.annotation-api-1.2/target/javax.annotation-api-1.2.jar -jar target/jersey-netty-app-1.0-SNAPSHOT.jar
      Error: VM option 'SharedArchiveFile' is diagnostic and must be enabled via -XX:+UnlockDiagnosticVMOptions.
      Error: The unlock option must precede 'SharedArchiveFile'.
      Error: Could not create the Java Virtual Machine.
      Error: A fatal exception has occurred. Program will exit.


            jiangli Jiangli Zhou
            ecaspole Eric Caspole
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: