JDK-6440118 : Shared archive not generated when jre/lib/endorsed contains more than one jar file
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2006-06-18
  • Updated: 2010-08-06
  • Resolved: 2006-06-19
Related Reports
Duplicate :  
Description
Class Data Sharing fails when more than one jar file is contained
in jre/lib/endorsed. The error message is:

# ./java -client -Xshare:dump
Loading classes to share ... done.
Rewriting and unlinking classes ... done.
Calculating hash values for String objects .. done.
Calculating fingerprints ... done.
Removing unshareable information ... done.
Moving most read-only objects to shared space at 0xd4400000 ... done.
Moving common symbols to shared space at 0xd473b870 ... done.
Moving remaining symbols to shared space at 0xd4853f10 ... done.
Moving string char arrays to shared space at 0xd48549a0 ... done.
Moving additional symbols to shared space at 0xd48d0b70 ... done.
Read-only space ends at 0xd4923678, 5387896 bytes.
Moving read-write objects to shared space at 0xd4c00000 ... done.
Moving String objects to shared space at 0xd5124f70 ... done.
Read-write space ends at 0xd5160ac0, 5638848 bytes.
Updating references to shared objects ... done.

An error has occured while processing the shared archive file.
Too many jar files to share.
Error occurred during initialization of VM
Unable to use shared archive.

Comments
EVALUATION This bug is a duplicate of bug 6304817 which was filed by me some time ago when I was performing the rt.jar splitting work. Ultimately, we should make JVM_SHARED_JARS_MAX as a tunnable parameter. I don't think there would be any compatibility concerns. 6304817 was committed to dolphin.
19-06-2006

SUGGESTED FIX The error is caused by the following code in share/vm/memory/filemap.cpp: // Build checks on classpath and jar files _header._num_jars = 0; ClassPathEntry *cpe = ClassLoader::classpath_entry(0); for ( ; cpe != NULL; cpe = cpe->next()) { if (cpe->is_jar_file()) { if (_header._num_jars >= JVM_SHARED_JARS_MAX) { fail_stop("Too many jar files to share.", NULL); } ... } Where JVM_SHARED_JARS_MAX is defined as 8. The default value is just large enough to handle the needs of the default boot class path. When HotSpot is redistributed more than one additional jar file in jre/lib/endorsed, it will trip over this maximum and fail to generate the shared archive.
18-06-2006