3 Replies Latest reply on Jun 8, 2014 3:42 PM by martins.tuga

    Wildfly 8 and ehcache

    mleichter

      For my project I need to migrate from Glassfish 3 with Hibernate 4.1.7.Final to Wildfly 8.0.0.Final which comes with Hibernate 4.3.1.Final.

       

      We use in the "old" environment something like this:

       

      @Cacheable

      @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)

       

      The EHcache supports CacheConcurrencyStrategy.READ_WRITE but the Infinispan does not.

       

       

      I also tried this here:

          <persistence-unit name="production" transaction-type="JTA">

              <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>

             <!-- ... -->

             

              <properties>

                  <property name="hibernate.transaction.jta.platform"

                            value="org.hibernate.engine.transaction.jta.platform.internal.JBossAppServerJtaPlatform"/>

                  <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>

                  <property name="hibernate.hbm2ddl.auto" value="none"/>

                  <property name="hibernate.format_sql" value="true"/>

                  <property name="hibernate.show_sql" value="false"/>

                  <property name="hibernate.ejb.naming_strategy" value="org.hibernate.cfg.ImprovedNamingStrategy"/>

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

                  <property name="hibernate.cache.provider_class" value="org.hibernate.cache.ehcache.EhCacheRegionFactory"/>           

              </properties>

          </persistence-unit>

       

      But this does not help.... still getting:

      2014-03-25 16:22:47,061 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 54) MSC000001: Failed to start service jboss.persistenceunit."demo.war#production": org.jboss.msc.service.StartException in service jboss.persistenceunit."demo.war#production": org.hibernate.cache.CacheException: Unsupported access type [read-write]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]

        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.7.0_51]

        at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:474)

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]

        at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]

        at org.jboss.threads.JBossThread.run(JBossThread.java:122)

      Caused by: org.hibernate.cache.CacheException: Unsupported access type [read-write]

        at org.hibernate.cache.infinispan.entity.EntityRegionImpl.buildAccessStrategy(EntityRegionImpl.java:68) [hibernate-infinispan-4.3.1.Final.jar:4.3.1.Final]

        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:364) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]

        at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]

        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]

        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:843) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]

        at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:399) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]

        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:842) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]

        at org.jboss.as.jpa.hibernate4.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44) [jipijapa-hibernate4-3-1.0.1.Final.jar:]

        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:154) [wildfly-jpa-8.0.0.Final.jar:8.0.0.Final]

        ... 8 more

       

      How to enable Ehcache as second level cache in Wildfly 8 ?

        • 1. Re: Wildfly 8 and ehcache
          smarlow

          Would be interesting to try copying the ehcache jar into the wildfly/modules/system/layers/base/org/hibernate/main folder and add a "resource-root" entry to wildfly/modules/system/layers/base/org/hibernate/main/module.xml for the ehcache.jar.

           

          Let us know if that helps.

          • 2. Re: Wildfly 8 and ehcache
            mleichter

            I already tried that.... but unfortunately I get also the same error.. in the StackTrace  is always infinispan listed. The ehcahe.jar is loaded, but Hibernate does not care. I also tried to comment the infinispan stuff in the module.xml... but this led to other issues....

             

            Some more ideas?

            • 3. Re: Wildfly 8 and ehcache
              martins.tuga

              I have the same problem.

              Anybody has a solution?