Why classes in the cache might not be found or stored

This quick guide helps you to diagnose why classes might not be being found or stored in the cache as expected.

Why classes might not be found

The class is stale
As explained in Understanding dynamic updates, if a class has been marked as "stale", it is not returned by the cache.
A JVMTI agent is being used without a modification context
If a JVMTI agent is being used without a modification context, classes cannot be found in the cache. The effect is to give the JVMTI agent an opportunity to modify the bytecode when the classes are loaded from disk. For more information, see Dealing with runtime bytecode modification.
The Classpath entry being used is not yet confirmed by the SharedClassURLClasspathHelper
Class path entries in the SharedClassURLClasspathHelper must be "confirmed" before classes can be found for these entries. A class path entry is confirmed by having a class stored for that entry. For more information about confirmed entries, see the SharedClassHelper Javadoc information.

Why classes might not be stored

The cache is full
The cache is a finite size, determined when it is created. When it is full, it cannot be expanded. When the verbose suboption is enabled a message is printed when the cache reaches full capacity, to warn the user. The printStats utility also displays the occupancy level of the cache, and can be used to query the status of the cache.
The cache is opened read-only
When the readonly suboption is specified, no data is added to the cache.
The class does not exist on the file system
The class might be sourced from a URL location that is not a file.
The class loader does not extend java.net.URLClassLoader
For a class loader to share classes, it must either extend java.net.URLClassLoader or implement the Java™ Helper API (see SharedClassHelper API)
The class has been retransformed by JVMTI and cacheRetransformed has not been specified
As described in Dealing with runtime bytecode modification, the option cacheRetransformed must be selected for retransformed classes to be cached.
The class was generated by reflection or Hot Code Replace
These types of classes are never stored in the cache.

Why classes might not be found or stored

Safemode is being used
Classes are not found or stored in the cache in safemode. This behavior is expected for shared classes. See Using the safemode option.
The cache is corrupted
In the unlikely event that the cache is corrupted, no classes can be found or stored.
A SecurityManager is being used and the permissions have not been granted to the class loader
SharedClassPermissions must be granted to application class loaders so that they can share classes when a SecurityManager is used. For more information, see the SDK and Runtime User Guide for your platform.


© Copyright IBM Corporation 2005, 2010. All Rights Reserved.
© Copyright Sun Microsystems, Inc. 1997, 2007, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
This information center is powered by Eclipse technology. (http://www.eclipse.org/)