1 Reply Latest reply on Apr 6, 2010 7:17 PM by gaborj

    ehcache not working in Jboss 5.1.oGG

      hi every one


      seam-2.2.0.GA and jboss 5.1.0.GA is my project environment.
      i wants to use the ehcache in my project.
      so i add the ehcache.jar file into ear lib folder.
      then i add following cache provider configuration in my component.xml file


      <components xmlns:cache="http://jboss.com/products/seam/cache"
      xsi:schemaLocation="http://jboss.com/products/seam/cache http://jboss.com/products/seam/cache-2.2.xsd"
      <cache:eh-cache-provider/>
      



      then i add the ehcache.xml file in my WEB-INF/classes folder. (ehcache.xml file from seam wiki example)
      then i wants to add the data in to the CacheProvider , when i start up the server.
      so i create a application scope component with @Startup annotaion.
      then i try to put a data into CacheProvider within @Create annotated method.


      @Stateful
      @AutoCreate
      @Scope(ScopeType.APPLICATION)
      @Startup
      @Name("initializer")
      final public class InitializerImpl implements Initializer 
      {
       @In 
      CacheProvider cacheProvider;
      
      @In
      private EntityManager entityManager;
      
      @Create
      public void initializeComponent()
      {               
      List<Customer> cusList=entityManager.createQuery("from Customer t ").getResultList();
      cacheProvider.put("cusList", cusList);
      }
      
      @Remove
      @Destroy
      public void destroy() 
      {}
      }
      



      i am getting following WARNING im my console.


      3:10:52,326 WARN  [ConfigurationFactory] No configuration found. Configuring eh
      cache from ehcache-failsafe.xml  found in the classpath: vfszip:/C:/Documents an
      d Settings/thiagu.m.CREATIVEIT/My Documents/Downloads/jboss-5.1.0.GA/server/defa
      ult/deploy/test.ear/lib/ehcache.jar/ehcache-failsafe.xml
      13:10:52,592 WARN  [CacheManager] Creating a new instance of CacheManager using
      the diskStorePath "C:\DOCUME~1\USER~1.CRE\LOCALS~1\Temp\" which is already use
      d by an existing CacheManager.
      The source of the configuration was classpath.
      The diskStore path for this CacheManager will be set to C:\DOCUME~1\USER~1.CRE
      \LOCALS~1\Temp\\ehcache_auto_created_1270107652592.
      To avoid this warning consider using the CacheManager factory methods to create
      a singleton CacheManager or specifying a separate ehcache configuration (ehcache
      .xml) for each CacheManager instance.
      


      when i try to get the data from the CacheProvider, it returns null value.


      List<Customer> list=(List<Customer>)cacheProvider.get("cusList");
      



      but the same ear working fine in the Jboss 4.2.3.GA.
      please any one help me how to resolve this issue.


      thiagu.m



        • 1. Re: ehcache not working in Jboss 5.1.oGG
          gaborj

          hi,


          the class loading mechanism changed in 5.1..., try and put the ehcache.xml into your jar where your entities, you can use the

          hibernate.cache.provider_configuration_file_resource_path

          in your persistence.xml to set the path explicitly...


          Gabor