1 Reply Latest reply on Nov 11, 2009 4:32 AM by sergey.olifirenko

    Ehcache as Hibernate Second Level cache configuring problem

      Hello!

      I use JBoss 4.2.2

      My problem is following:

      I have application packaged as ear. Application has separated class loader configured via *.ear/META-INF/jboss-app.xml.

      I use ehcache as second level cache provider. I had to add ehcache lib to JBOSS_HOME/server/default/lib. Because hibernate libs a loaded by parent classloader and can't see ehcache lib inside of ear.

      persistence.xml is correctly configured with following props:

      property name="hibernate.cache.use_second_level_cache" value = "true"
      property name="hibernate.cache.use_query_cache" value="true"
      property name="hibernate.cache.provider_class"
      value="org.hibernate.cache.EhCacheProvider"
      property name="hibernate.cache.provider_configuration" value="_ehcache.xml"


      After such configuration server always runs with following:

      10:09:50,800 ERROR [STDERR] Nov 10, 2009 10:09:50 AM net.sf.ehcache.config.Confi
      gurationFactory parseConfiguration
      WARNING: No configuration found. Configuring ehcache from ehcache-failsafe.xml
      found in the classpath: jar:file:/C:/java_Program_Files/jboss-4.2.2.GA/server/de
      fault/lib/ehcache-core-1.7.0.jar!/ehcache-failsafe.xml

      Hibernate doesn't see my _ehcache.xml.
      I've tried put _ehcache.xml in:
      ear root.
      ear's META-INF, jar's META-INF

      I need advise where I can put my ehcache configuration file so Hibernate be able to parse it. Prefferably configuration should be packaged in ear.

      Thank you!