Class loading within the plethora of environments ehcache can be running is a somewhat vexed issue.
Since ehcache-1.2 all classloading is done using a standard classloader which uses Thread.currentThread().getContextClassLoader().
Ehcache allows plugins for events and distribution. These are loaded and created as follows:
Class clazz = Class.forName(className, true, getStandardClassLoader()); newInstance = clazz.newInstance();
If this does not work for some reason a CacheException is thrown with a detailed error message.
If the configuration is otherwise unspecified, ehcache looks for a configuration in the following order:
Ehcache uses the first configuration found.
Note the use of "/ehcache.xml" which requires that ehcache.xml be placed at the root of the classpath, i.e. not in any package.