Reputation: 490
I have migrated my project from glassfish2.2.1 to JBoss eap-6.0. After migrating to Jboss, i am getting the below issue
17:38:45,581 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 62) MSC000001: Failed to start service jboss.persistenceunit."unbranded.ear#entityManager": org.jboss.msc.service.StartException in service jboss.persistenceunit."unbranded.ear#entityManager": javax.persistence.PersistenceException: [PersistenceUnit: entityManager] Unable to build EntityManagerFactory at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:100) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_23] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_23] at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_23] at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: entityManager] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:915) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:890) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:197) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$500(PersistenceUnitServiceImpl.java:57) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:96) ... 4 more
Caused by: org.hibernate.cache.CacheException: Unsupported access type [nonstrict-read-write] at org.hibernate.cache.infinispan.entity.EntityRegionImpl.buildAccessStrategy(EntityRegionImpl.java:33) at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:345) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1746) at org.hibernate.ejb.EntityManagerFactoryImpl.(EntityManagerFactoryImpl.java:94) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:905) ... 9 more
If you checked the logs in bold it is taking the infinispan cache, that's why it is causing the issue Unsupported access type [nonstrict-read-write], because infinispan doesn't support this one.
But is my persistence.xml i have configured the ehcache. Below is my persistence.xml
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0"> org.hibernate.ejb.HibernatePersistence jdbc/ejb/unbranded casinomodule.core.audit.AuditTrail<!-- <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.CMTTransactionFactory"/> --> <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.SunONETransactionManagerLookup"/> <property name="hibernate.cache.use_query_cache" value="true"/> <property name="hibernate.query.jpaql_strict_compliance" value="false"/> <property name="hibernate.session_factory_name" value="HibernateSession"/> <property name="hibernate.bytecode.use_reflection_optimizer" value="true"/> <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.SingletonEhCacheProvider"/> <property name="hibernate.cache.use_second_level_cache" value="true"/> </properties> </persistence-unit> </persistence>
Don't know why jboss is taking the infinispan instead of Ehcache.
thanks
Upvotes: 0
Views: 2723
Reputation: 490
Ok, i figure out the problem.
This is causing due to old maven dependency and a property which i added in my persistence.xml file.
Below is the maven dependency:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>4.1.9.Final</version>
</dependency>
Below is the new property added in my persistence.xml file.
<property name="hibernate.cache.region.factory_class" value="net.sf.ehcache.hibernate.EhCacheRegionFactory"/>
This is happening because i am using JBoss eap-6.0. which also used hibernate as JPA provider and it is using hibernate 4.1.9.Final version. And previously in my maven i had given the dependency of hibernate as 3.4.6
Upvotes: 0