2 Replies Latest reply on Jul 3, 2012 10:51 AM by Rico Neubauer

    Infinispan Hibernate 2nd level caching not working

    Newbie

      I am trying to configure second level caching for hibernate using Infinispan. My JBoss AS version is 7.1.1 (Final) Brontes release.

       

      I have followed all the suggestions mentioned in the thread: 

      https://community.jboss.org/thread/177214?tstart=0

       

      However, I am still getting the below exception

      Caused by: java.lang.NullPointerException

          at org.hibernate.cache.infinispan.InfinispanRegionFactory.getCache(InfinispanRegionFactory.java:445)

          at org.hibernate.cache.infinispan.InfinispanRegionFactory.buildEntityRegion(InfinispanRegionFactory.java:198)

          at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:339)

          at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)

          at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)

          at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)

          at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)

          at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

          ... 3 more

       

      Can someone please help me in getting through this?

       

      I have also added the below to my standalone.xml file for "Eager" start:

      <subsystem xmlns="urn:jboss:domain:infinispan:1.2" default-cache-container="hibernate">

                  <cache-container name="hibernate" default-cache="local-query" start="EAGER">

      .......

       

      Also,

       

      My persistence.xml has the following properties related to 2nd level caching:

       

      <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode>

      <properties>

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

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

      </properties>