-
Bug
-
Resolution: Fixed
-
P3
-
20
-
b26
The -XX:+AutoCreateSharedArchive flag was implemented in JDK 19 (JDK-8261455). However, this flag doesn't work across JDK 19 and 20.
Expected: JDK 20 should recreate the specified CDS archive
Actual: JDK 20 cannot recognize the archive file and gives up
$ rm foo.jsa
$ ./jdk-19/bin/java -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=foo.jsa -cp HelloWorld.jar HelloWorld
Hello World
$ ls -l foo.jsa
-r--r--r-- 1 iklam iklam 241664 Nov 9 17:58 foo.jsa
$ java -showversion -Xlog:cds -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=foo.jsa -cp HelloWorld.jar HelloWorld
[0.000s][info][cds] UseSharedSpaces: The shared archive file version 0xe does not match the required version 0x11.
[0.000s][info][cds] UseSharedSpaces: Invalid base_archive_name offset/size: 0/527052459
Java HotSpot(TM) 64-Bit Server VM warning: -XX:+AutoCreateSharedArchive is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.
[0.000s][info][cds] Unable to use shared archive: invalid archive
java version "20-internal" 2023-03-21
Java(TM) SE Runtime Environment (build 20-internal-adhoc.iklam.rum)
Java HotSpot(TM) 64-Bit Server VM (build 20-internal-adhoc.iklam.rum, mixed mode)
Hello World
Expected: JDK 20 should recreate the specified CDS archive
Actual: JDK 20 cannot recognize the archive file and gives up
$ rm foo.jsa
$ ./jdk-19/bin/java -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=foo.jsa -cp HelloWorld.jar HelloWorld
Hello World
$ ls -l foo.jsa
-r--r--r-- 1 iklam iklam 241664 Nov 9 17:58 foo.jsa
$ java -showversion -Xlog:cds -XX:+AutoCreateSharedArchive -XX:SharedArchiveFile=foo.jsa -cp HelloWorld.jar HelloWorld
[0.000s][info][cds] UseSharedSpaces: The shared archive file version 0xe does not match the required version 0x11.
[0.000s][info][cds] UseSharedSpaces: Invalid base_archive_name offset/size: 0/527052459
Java HotSpot(TM) 64-Bit Server VM warning: -XX:+AutoCreateSharedArchive is unsupported when base CDS archive is not loaded. Run with -Xlog:cds for more info.
[0.000s][info][cds] Unable to use shared archive: invalid archive
java version "20-internal" 2023-03-21
Java(TM) SE Runtime Environment (build 20-internal-adhoc.iklam.rum)
Java HotSpot(TM) 64-Bit Server VM (build 20-internal-adhoc.iklam.rum, mixed mode)
Hello World
- relates to
-
JDK-8261455 Automatically generate the CDS archive if necessary
- Resolved
-
JDK-8279366 CDS should allow alternative locations for JAR files in classpath
- Resolved
-
JDK-8287873 Add test for using -XX:+AutoCreateSharedArchive with different JDK versions
- Resolved