从 JBoss AS 7.1 迁移到 JBoss EAP 7.3.0

Posted

技术标签:

【中文标题】从 JBoss AS 7.1 迁移到 JBoss EAP 7.3.0【英文标题】:Migrating from JBoss AS 7.1 to JBoss EAP 7.3.0 【发布时间】:2021-02-22 21:58:47 【问题描述】:

我们正在从 Jboss AS 7.1 迁移到 Jboss EAP 7.3.0,我们收到以下错误:

<<
22:36:16,304 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC000001: Failed to start service jboss.deployment.unit."ejb-application.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."ejb-application.ear".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "ejb-application.ear"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:183)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
    at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
    at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0019: Could not deploy application packaged persistence provider 'org.hibernate.jpa.HibernatePersistenceProvider'
    at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:80)
    at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:49)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:176)
    ... 8 more
Caused by: java.lang.ClassCastException: class org.hibernate.jpa.HibernatePersistenceProvider
    at java.lang.Class.asSubclass(Class.java:3404)
    at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:73)
    ... 10 more
>>

这是我们的 Persistence.xml 文件

<<
<persistence version="2.1"
   xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
        http://xmlns.jcp.org/xml/ns/persistence
        http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
   <persistence-unit name="jboss">
      <!-- If you are running in a production environment, add a managed
         data source, this example data source is just for development and testing! -->
      <!-- The datasource is deployed as WEB-INF/hibernate-quickstart-ds.xml, you
         can find it in the source at src/main/webapp/WEB-INF/hibernate-quickstart-ds.xml -->
      <jta-data-source>java:jboss/jdbc/AppDatasource</jta-data-source>
      <properties>
         <!-- Properties for Hibernate -->
         <property name="hibernate.hbm2ddl.auto" value="create-drop" />
         <property name="hibernate.show_sql" value="false" />
      </properties>
   </persistence-unit>
</persistence>
>>

我们知道这与persistence.xml 和jboss-deployment-structure.xml 文件有关。 我们尝试在文件中包含/排除所有相关模块,但仍然遇到上述问题。 此外,我们正在从 Hibernate 3 迁移到 Hibernate 5。

请帮助解决此问题。

【问题讨论】:

【参考方案1】:

看起来您可能将 Hibernate 与您的应用程序一起打包在不同的版本中,或者您在 jboss-deployment-structure.xml 中排除了 Hibernate 版本

【讨论】:

以上是关于从 JBoss AS 7.1 迁移到 JBoss EAP 7.3.0的主要内容,如果未能解决你的问题,请参考以下文章

EJB 远程客户端从 JBoss AS 7.1 迁移到 Wildfly 8.1

从 Tomcat 7 迁移到 JBoss7.1

从Jboss EAP 6.4迁移到EAP 7.1

JBoss as7 到 WildFly 的 Hibernate 迁移

javax.xml.parsers.FactoryConfigurationError 运行 JBoss AS 7.1 和 Java 7 更新 171

迁移到 Jboss 7.0 AS 后 Firefox 和 IE 中的 ViewExpiredException