• Bug
  • Status: Closed
  • Resolution: Fixed
  • drb
  • Reporter: sourceforgetracker
  • September 21, 2009
  • 0
  • Watchers: 0
  • September 22, 2009
  • September 22, 2009

Description

I am using ehcache 0.9 with hibernate 3.0. For my suite of applications, I am using hibernate (and therefore ehcache) as a configurable service that is deployed independent of the application. The cache is configured by the application through the file ehcache.xml, which on the application’s classpath.

The method net.sf.ehcache.config.Configurator.configure( Object) loads ehcache.xml using the class loader from the Configurator class. Since ehcache is loaded by a class loader “downstream” of my application, it does not find this file.

In Hibernate, they use the thread’s classloader for configuration loading. I wonder if the same approach would be appropriate here? For example, to work around the problem, in the configure method, I changed: URL url = getClass().getResource(DEFAULT_CLASSPATH_CONFIGURATION_FILE);

to ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL url = classLoader.getResource(DEFAULT_CLASSPATH_CONFIGURATION_FILE);

(An alternative solution would be for hibernate’s EHCaceProvider to instantiate a URL for ehcache.xml and this pass this to the configure(Object, URL) method, so I will also post this issue to Hibernate.)

Thanks. Sourceforge Ticket ID: 1079529 - Opened By: ethanocentrism - 5 Dec 2004 19:35 UTC

Comments

Fiona OShea 2009-09-22

Re-opening so that I can properly close out these issues and have correct Resolution status in Jira