1 Reply Latest reply on Oct 22, 2005 7:46 PM by ardenqw

    Can not use ehcache in jboss 4.0.3

    ardenqw

      I installed jboss under D:\jboss-4.0.3
      First, in my hibernate.cfg.xml, I have not defined hibernate.cache.provider_class, because I think the default cache provider is ehcache.
      I got followin error messages:
      =======================
      ...
      17:35:15,890 INFO [SettingsFactory] Cache provider: org.hibernate.cache.EhCacheProvider
      17:35:15,906 ERROR [HibernateUtil] HibernateUtil.static: Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: net/sf/ehcache/CacheException
      ...
      ========================

      Then, I found jboss-4.0.3 needs ehcache-1.1.jar, so I got ehcache-1.1.jar from hibernate-3.1.beta3.zip, because during I startup jboss, i got following message:
      =================================
      17:35:10,421 INFO [Environment] Hibernate 3.1 beta 3
      ===============================
      I copy ehcache-1.1.jar into D:\jboss-4.0.3\server\default\lib

      Now, everything is ok, my application (just a simple session bean) could get data from database through hibernate, but I got another WARN message:
      ===============================
      17:44:05,109 WARN [Configurator] No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/jboss-4.0.3/server/default/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
      ===============================
      I try to put one META-INF/ehcache.xml in my ejar jar file, but hibernate could find my ehcache configuration at all. (this is my first problem)

      If I defined
      net.sf.ehcache.hibernate.Provider
      in my hibernate.cfg.xml,
      I will following error message, even I have added ehcache-1.1.jar
      ================================
      17:52:16,703 ERROR [HibernateUtil] HibernateUtil.static: Initial SessionFactory creation failed.org.hibernate.HibernateException: could not instantiate CacheProvider: net.sf.ehcache.hibernate.Provider
      17:52:17,921 ERROR [LogInterceptor] Unexpected Error in method: public abstract arden.pshop.ejbclient.CheckUserResult arden.pshop.ejb.interfaces.Pshop.checkUser(java.lang.String,java.lang.String) throws arden.pshop.PshopException,java.rmi.RemoteException
      java.lang.NoClassDefFoundError
      ===================================
      it is my second problem . :-((

        • 1. Re: Can not use ehcache in jboss 4.0.3
          ardenqw

          The content of ehcache.xml is not right, it is the rootcause of second problem.
          But I have not find a good place to put ehcache.xml, now, I put it into ehcache-1.1.jar (It is not a good place at all), everything does work. :))