Class Data Sharing in Java 5
Hi All,
I am looking at porting over our current Java application from Java 1.4.2 to Java 1.5.
One of the main reasons is because of the CDS facility in Java 1.5.
Running the same app, one on 1.4.2 and the other on 1.5, on 1.5 it uses about 20% more memory !!!!
This application involves 3 JVM's running communicating via RMI.
When I start each of the applications with -Xshare:on, the first starts fine, indicating it is using CDS,
(-showversion parameter will indicate sharing), but then the next two wont start giving an error indicating
the shared archive cannot be accessed.
Before I started the apps I manually created the shared archive using the call java -Xshare:dump which
places the classes.jsa file in the directory jre/lib/i386/client/classes.jsa
I am running an Intel Solaris platform.
Any ideas why this isnt working ?
[908 byte] By [
gbohan] at [2007-9-30 21:34:06]

> jre/lib/i386/client/classes.jsa
>
> I am running an Intel Solaris platform.
>
>giving an error indicating the shared archive cannot be accessed.
Please cut/paste the exact text of the error message.
> Any ideas why this isnt working ?
Are all three VMs running as the same user? If not, is the jre/lib/i386/client/classes.jsa file accessable to all users?
Are you running with -client? (Dumping/using a shared archive is not supported on the Server JVM.)
--
"Troubleshooting Guide for J2SE 5.0",
http://java.sun.com/j2se/1.5/pdf/jdk50_ts_guide.pdf
ok, I have some more information after doing more investigation...
Here is the bug which I submitted to Sun...
FULL OS VERSION :
SunOS con1 5.8 Generic_108529-29 i86pc i386 i86pc
A DESCRIPTION OF THE PROBLEM :
I am running an application with 3 JVM's. I have manually enabled Class Data Sharing using the command java -Xshare:dump. This seems to work fine.
When I start the first JVM with the command line option -Xshare:on it seems to start fine and indicates "sharing" when I print out -showversion.
Then when I start any subsequent JVM's with -Xshare:on AND the -Xmx5m parameter I receive the following error:
An error has occured while processing the shared archive file. Unable to reserve shared region. Error occurred during initialization of VM Unable to use shared archive.
It seems to work fine if I dont set the maximum heap size.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: No
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Try to execute a JVM with class data sharing on, then try it again with class data sharing on, AND trying to set the maximum heap size.
EXPECTED VERSUS ACTUAL BEHAVIOR :
It should still allow CDS.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
An error has occured while processing the shared archive file. Unable to reserve shared region. Error occurred during initialization of VM Unable to use shared archive.
REPRODUCIBILITY :
This bug can be reproduced always.
The error only occurs when using Xshare AND Xms<NUMBER>m as parameters !