• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • ehcache-core
  • hsingh
  • Reporter: ihrstaal
  • March 24, 2010
  • 0
  • Watchers: 1
  • January 17, 2013
  • April 22, 2010


Before ehcache 2.0.0, my cache configuration was:

org.hibernate.cache.EhCacheProvider file:C:/myfolder/mycacheconfig.xml

The configuration file (outside the classpath) could be located without problems by org.hibernate.util.ConfigHelper#locateConfig:

API docs: Try to locate a local URL representing the incoming path. The first attempt assumes that the incoming path is an actual URL string (file://, etc). If this does not work, then the next attempts try to locate this UURL as a java system resource.

After upgrading to 2.0.0, I had to change the configuration to:

net.sf.ehcache.hibernate.EhCacheRegionFactory file:C:/myfolder/mycacheconfig.xml

But in net.sf.ehcache.hibernate.AbstractEhcacheRegionFactory#loadResource, the configuration (located outside the classpath: C:/myfolder/mycacheconfig.xml) could not be loaded.

API docs: Load a resource from the classpath.

This is quite suboptimal because in our project the cache configuration file has to be located outside the classpath.


Alfred Staflinger 2010-03-24

Hibernate version is: 3.3.2

Chris Dennis 2010-03-24

Yes, it seems this is a key difference between the provider in the Hibernate source repository, and the provider in the Ehcache source repository. The Hibernate provider supports providing a URL as a configuration location, and the Ehcache provider does not. From looking at the source code in the two repositories it seems this distinction has existed for as long as there have been two providers. Greg may know more on the details of this I imagine.

Fiona OShea 2010-03-30

Steve thinks you were looking into this, and may have some ideas

Himadri Singh 2010-07-06

Verified w/ all-in-one webapp, moved ehcache-hibernate.xml from the classpath and gave file: in hibernate.cfg.xml

product-name = Ehcache Core version = 2.2.0 built-by = jvoegele build-jdk = 1.6.0_20 build-time = 2010-06-29 09:02:37 build-revision = 2535