2 Replies Latest reply: May 10, 2012 9:23 AM by Scott Marlow RSS

    Problem to use Infinispan as hibernate 2nd level cache in JBoss-AS-7.1.1.Final

    Sajid Mahmood Newbie

      Hi all,

       

      I am using Infinispan as hibernate second level cache, My hibernate configuration file contains the following elements

        

        <property name="hibernate.cache.use_second_level_cache">true</property>

                          <property name="hibernate.cache.use_query_cache">true</property>

                          <property name="hibernate.cache.region.factory_class">org.hibernate.cache.infinispan.JndiInfinispanRegionFactory</property>

                          <property name="hibernate.cache.provider_configuration_file_resource_path">/ehcache.xml</property>

                          <property name="hibernate.cache.infinispan.cachemanager">java:jboss/infinispan/hibernate</property>

       

      i am starting my JBoss server with standalone-ha.xml profile but i am getting the following exception

       

      org.apache.jasper.JasperException: org.hibernate.cache.CacheException: Unable to start region factory

      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:413)

      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)

      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)

      javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

       

      root cause

      org.hibernate.cache.CacheException: Unable to start region factory
           org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:270)
           org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:221)
           org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
           org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
           com.L2TestMain.testCache(L2TestMain.java:20)
           org.apache.jsp.index_jsp._jspService(index_jsp.java:59)
           org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
           org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
           org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
           org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

       

      root cause

      java.lang.ClassCastException: org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager cannot be cast to org.infinispan.manager.EmbeddedCacheManager
           org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.locateCacheManager(JndiInfinispanRegionFactory.java:75)
           org.hibernate.cache.infinispan.JndiInfinispanRegionFactory.createCacheManager(JndiInfinispanRegionFactory.java:68)
           org.hibernate.cache.infinispan.InfinispanRegionFactory.start(InfinispanRegionFactory.java:256)
           org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:221)
           org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1341)
           org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
           com.L2TestMain.testCache(L2TestMain.java:20)
           org.apache.jsp.index_jsp._jspService(index_jsp.java:59)
           org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
           org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
           org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
           org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

       

      Please give me any clue,

      Thanks in advance.