"java.lang.IllegalStateException: EntityManagerFactory is closed" in JBoss EAP
Issue
Encountering an "EntityManagerFactory is closed" error when trying to work with container managed entity manager instances.
... java.lang.IllegalStateException: EntityManagerFactory is closed
at org.hibernate.internal.SessionFactoryImpl.validateNotClosed(SessionFactoryImpl.java:531)
at org.hibernate.internal.SessionFactoryImpl.getProperties(SessionFactoryImpl.java:525)
at org.jboss.as.jpa.config.Configuration.skipMixedSynchronizationTypeCheck(Configuration.java:345)
at org.jboss.as.jpa.container.TransactionScopedEntityManager.testForMixedSynchronizationTypes(TransactionScopedEntityManager.java:215)
at org.jboss.as.jpa.container.TransactionScopedEntityManager.getOrCreateTransactionScopedEntityManager(TransactionScopedEntityManager.java:166)
at org.jboss.as.jpa.container.TransactionScopedEntityManager.getEntityManager(TransactionScopedEntityManager.java:87)
...
Environment
- Red Hat JBoss Enterprise Application Platform (EAP) 7
- Hibernate 5
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.