0

我最近从wildfly 10迁移到wildfly 13。从控制台部署模块时出现这个奇怪的错误

 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)

奇怪的是,应用程序运行得相当频繁,但是从控制台看不到部署。Wildfly 上的模块休眠结构如下

├── 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

任何帮助将非常感激。谢谢

4

1 回答 1

0

我为可能陷入相同情况的人回答我自己的问题。经过数小时的努力并遇到了一些类似的 wldfly 问题,我了解到这可能是由于 wildlfy 发布的休眠版本的错误。由于我已将休眠 5.2 用于 ogm 合规性,因此我通过在 pesistence.xml 中发布此属性来指示 Wildfly 也使用休眠 5.2

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

问题解决了

于 2018-07-20T09:59:33.010 回答