Wildfly 13 Operation ("read-attribute") subsystem jpa

1.4k Views Asked by At

I have recently migrated from wildfly 10 to wildfly 13. when deploying modules from console I get this weird error

 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 1) WFLYCTL0013: Operation ("read-attribute") failed - address: ([
("deployment" => "swp.admin.registry.war"),
("subsystem" => "jpa"),
("hibernate-persistence-unit" => "swp.admin.registry.war#primary")
]): javax.persistence.PersistenceException: Hibernate cannot unwrap 
EntityManagerFactory as 'org.hibernate.SessionFactory'
 at  org.hibernate.jpa.internal.EntityManagerFactoryImpl.unwrap(EntityManagerFactoryImpl.java:496)
    at org.jboss.as.jpa.hibernate5.management.HibernateStatistics.getStatistics(HibernateStatistics.java:216)
    at org.jboss.as.jpa.hibernate5.management.HibernateStatistics$16.invoke(HibernateStatistics.java:361)
    at org.jboss.as.jpa.hibernate5.management.HibernateAbstractStatistics.getValue(HibernateAbstractStatistics.java:99)
    at org.jboss.as.jpa.management.ManagementResourceDefinition$1.handle(ManagementResourceDefinition.java:130)
    at org.jboss.as.jpa.management.ManagementResourceDefinition$AbstractMetricsHandler.executeRuntimeStep(ManagementResourceDefinition.java:268)
    at org.jboss.as.controller.AbstractRuntimeOnlyHandler$1.execute(AbstractRuntimeOnlyHandler.java:59)
    at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:999)
    at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:743)
    at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:467)
    at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1404)
    at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:423)
    at org.jboss.as.controller.ModelControllerImpl.lambda$execute$1(ModelControllerImpl.java:243)
    at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:263)
    at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:229)
    at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:243)
    at org.jboss.as.domain.http.server.DomainApiHandler.handleRequest(DomainApiHandler.java:212)
    at io.undertow.server.handlers.encoding.EncodingHandler.handleRequest(EncodingHandler.java:72)
    at org.jboss.as.domain.http.server.DomainApiCheckHandler.handleRequest(DomainApiCheckHandler.java:93)
    at org.jboss.as.domain.http.server.security.ElytronIdentityHandler.lambda$handleRequest$0(ElytronIdentityHandler.java:62)
    at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:287)
    at org.wildfly.security.auth.server.SecurityIdentity.runAs(SecurityIdentity.java:244)
    at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:254)
    at org.jboss.as.controller.AccessAuditContext.doAs(AccessAuditContext.java:225)
    at org.jboss.as.domain.http.server.security.ElytronIdentityHandler.handleRequest(ElytronIdentityHandler.java:61)
    at io.undertow.server.handlers.BlockingHandler.handleRequest(BlockingHandler.java:56)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:360)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
    at java.lang.Thread.run(Thread.java:748)
    at org.jboss.threads.JBossThread.run(JBossThread.java:485)

the strange thing is that application is running fairly often however the deployments are not visible from console. The module hibernate structure on the wildfly is the below

├── 4.3
│   └── module.xml
├── 5.0
│   └── module.xml
├── 5.2
│   └── module.xml
├── 5.2.16.Final
│   ├── byte-buddy-1.6.14.jar
│   ├── hibernate-core-5.2.16.Final.jar
│   ├── hibernate-envers-5.2.16.Final.jar
│   └── module.xml
├── commons-annotations
│   └── main
│       ├── hibernate-commons-annotations-5.0.2.Final.jar
│       └── module.xml
├── envers
│   └── main
│       └── module.xml
├── hql
│   └── 1.5.0.Final
│       ├── antlr-runtime-3.4.jar
│       ├── hibernate-hql-lucene-1.5.0.Final.jar
│       ├── hibernate-hql-parser-1.5.0.Final.jar
│       └── module.xml
├── infinispan
│   ├── 5.2
│   │   └── module.xml
│   ├── 5.2.16.Final
│   │   ├── hibernate-infinispan-5.2.16.Final.jar
│   │   └── module.xml
│   └── main
│       └── module.xml
├── jipijapa-hibernate4-3
│   └── main
│       ├── jipijapa-hibernate4-3-13.0.0.Final.jar
│       └── module.xml
├── jipijapa-hibernate5
│   ├── 5.2
│   │   └── module.xml
│   ├── 5.2.16.Final
│   │   ├── jipijapa-hibernate5-11.0.0.Final.jar
│   │   └── module.xml
│   └── main
│       ├── jipijapa-hibernate5-13.0.0.Final.jar
│       ├── jipijapa-hibernate5-3-13.0.0.Final.jar
│       ├── jipijapa-hibernate5-3-legacy-13.0.0.Final.jar
│       ├── jipijapa-hibernate5-legacy-13.0.0.Final.jar
│       └── module.xml
├── main
│   ├── hibernate-core-5.1.14.Final.jar
│   ├── hibernate-core-5.3.1.Final.jar
│   ├── hibernate-entitymanager-5.1.14.Final.jar
│   ├── hibernate-envers-5.1.14.Final.jar
│   ├── hibernate-envers-5.3.1.Final.jar
│   ├── hibernate-java8-5.1.14.Final.jar
│   └── module.xml
├── ogm
│   ├── 5.3
│   │   ├── hibernate-ogm-core-5.3.1.Final.jar
│   │   └── module.xml
│   ├── infinispan-embedded
│   │   ├── 5.3
│   │   │   ├── hibernate-ogm-infinispan-embedded-5.3.1.Final.jar
│   │   │   └── module.xml
│   │   └── main
│   │       └── module.xml
│   ├── infinispan-remote
│   │   ├── 5.3
│   │   │   ├── hibernate-ogm-infinispan-remote-5.3.1.Final.jar
│   │   │   └── module.xml
│   │   └── main
│   │       └── module.xml
│   ├── internal
│   │   └── parboiled
│   │       └── 5.3
│   │           ├── asm-5.2.jar
│   │           ├── asm-analysis-5.2.jar
│   │           ├── asm-tree-5.2.jar
│   │           ├── asm-util-5.2.jar
│   │           ├── module.xml
│   │           ├── parboiled-core-1.1.8.jar
│   │           └── parboiled-java-1.1.8.jar
│   ├── jipijapa
│   │   └── 5.3.1.Final
│   │       ├── hibernate-ogm-jipijapa-5.3.1.Final.jar
│   │       └── module.xml
│   ├── main
│   │   └── module.xml
│   ├── mongodb
│   │   ├── 5.3
│   │   │   ├── hibernate-ogm-mongodb-5.3.1.Final.jar
│   │   │   ├── module.xml
│   │   │   └── mongo-java-driver-3.6.3.jar
│   │   └── main
│   │       └── module.xml

Any help would be much appreciated. Thank you

1

There are 1 best solutions below

0
On

I answer my own question for people who might fall into the same situation. After hours of effort and coming through some similar wldfly issues I read that this might was due to a bug of the hibernate version that wildlfy was shipped. since I had put hibernate 5.2 for ogm compliance I instructed wildfly to use also hibernate 5.2 by issuing this property in pesistence.xml

<property name="jboss.as.jpa.providerModule" value="org.hibernate:5.2"/>

and the problem was resolved