2 Replies Latest reply on Jul 8, 2014 5:26 AM by sshyika

    Enabling Hibernate 2nd Level cache w/ infinispan in HA mode results in an exception

    meetoblivion

      Hi

       

      I was able to get 2nd level cache enabled in my application in standalone mode.  Now I'm trying to also run it in HA configuration.  It's mostly POC at this point so that we can do benchmarking.

       

      This is the stack trace I'm getting:

       

      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: EEApp] Unable to build EntityManagerFactory

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

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

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

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

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$600(PersistenceUnitServiceImpl.java:57)

              at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:99)

              ... 4 more

      Caused by: org.hibernate.cache.CacheException: Infinispan custom cache command factory not installed (possibly because the classloader where Infinispan lives couldn't

      Hibernate Infinispan cache provider)

              at org.hibernate.cache.infinispan.InfinispanRegionFactory.getCacheCommandFactory(InfinispanRegionFactory.java:546)

              at org.hibernate.cache.infinispan.InfinispanRegionFactory.startRegion(InfinispanRegionFactory.java:423)

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

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

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

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

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

              ... 9 more

       

      So, I'm getting this, and based on some docs I saw, I needed to modify my dependencies.  So I went in to my jboss-deployment-structure.xml and added:

       

      <module name="org.infinispan" services="import"/>

       

      however, the issue remains.  Everything does work fine in non HA mode, so I think it may be occurring because the AS is is loading the class as a part of its own start up to do replication.

       

      I'm using JBoss AS 7.1 and EAP 6.1, and it happens in both.