JDK-8284313 : Improve warning messages when CDS archive fails to load
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 19
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2022-04-04
  • Updated: 2023-12-01
  • Resolved: 2022-08-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 20
20 b11Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
When a CDS archive fails to load, we should print more helpful messages so that the user can diagnose the error more easily. This should be done for both static and dynamic archives.

===========================================
~/tmp/8279366/copied$ java -cp HelloWorld.jar --show-version -XX:SharedArchiveFile=HelloWorld.jsa HelloWorld
[0.028s][warning][cds,dynamic] Unable to use shared archive. The top archive failed to load: HelloWorld.jsa
java 17 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
Hello World

In the above message, we should also print something like:

Hint: enable -Xlog:class+path=info to diagnose the failure

===========================================
~/tmp/8279366/copied$ java -Xlog:class+path -cp HelloWorld.jar --show-version -XX:SharedArchiveFile=HelloWorld.jsa HelloWorld
[0.002s][info][class,path] bootstrap loader class path=/jdk/official/jdk17/lib/modules
[0.032s][info][class,path] Expecting BOOT path=/jdk/official/jdk17/lib/modules
[0.032s][info][class,path] Expecting -Djava.class.path=
[0.032s][info][class,path] checking shared classpath entry: /jdk/official/jdk17/lib/modules
[0.032s][info][class,path] ok
[0.032s][info][class,path] Expecting BOOT path=/jdk/official/jdk17/lib/modules
[0.032s][info][class,path] Expecting -Djava.class.path=HelloWorld.jar
[0.032s][info][class,path] checking shared classpath entry: /jdk/official/jdk17/lib/modules
[0.032s][info][class,path] ok
[0.032s][info][class,path] checking shared classpath entry: HelloWorld.jar
[0.032s][warning][cds,dynamic] Unable to use shared archive. The top archive failed to load: HelloWorld.jsa
java 17 2021-09-14 LTS
Java(TM) SE Runtime Environment (build 17+35-LTS-2724)
Java HotSpot(TM) 64-Bit Server VM (build 17+35-LTS-2724, mixed mode, sharing)
Hello World

In the above message, we should also print something like:

HelloWorld.jar timestamp has changed
Comments
Changeset: 22d6d315 Author: Calvin Cheung <ccheung@openjdk.org> Date: 2022-08-12 16:39:55 +0000 URL: https://git.openjdk.org/jdk/commit/22d6d315f2b1e0838d07bd30b6c2d58b5f98878b
12-08-2022

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/9823 Date: 2022-08-10 17:19:51 +0000
10-08-2022