我正在尝试将当前在WildFly 26.1.2.Final上运行的应用程序部署到WildFly 27.0.0.Final。部署失败,出现以下错误:
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."jee2ap102-ear.ear".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."jee2ap102-ear.ear".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "jee2ap102-ear.ear"
at org.jboss.as.server@19.0.0.Final//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:189)
at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at org.jboss.msc@1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: jakarta.persistence.PersistenceException: WFLYJPA0057: PersistenceProvider 'org.eclipse.persistence.jpa.PersistenceProvider' not found
at org.jboss.as.jpa@27.0.0.Final//org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.lookupProvider(PersistenceUnitServiceHandler.java:999)
at org.jboss.as.jpa@27.0.0.Final//org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.nextPhaseDependsOnPersistenceUnit(PersistenceUnitServiceHandler.java:1042)
at org.jboss.as.jpa@27.0.0.Final//org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:138)
at org.jboss.as.jpa@27.0.0.Final//org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
at org.jboss.as.server@19.0.0.Final//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182)
... 8 more
我使用了与以前版本相同的配置,即:
1.复制到C:\wildfly-27.0.0。最终\模块\系统\层\基础\组织\eclipse\persistence\main。
1.修改该目录中的module.xml文件,添加与eclipselink-2.7.8.jar对应的资源。
<properties>
<property name="jboss.api" value="public"/>
</properties>
<resources>
<resource-root path="jipijapa-eclipselink-27.0.0.Final.jar"/>
<resource-root path="eclipselink-2.7.8.jar">
<filter>
<exclude path="javax/**" />
</filter>
</resource-root>
</resources>
<dependencies>
<module name="java.logging"/>
<module name="java.management"/>
<module name="java.naming"/>
<module name="jakarta.annotation.api"/>
<module name="jakarta.enterprise.api"/>
<module name="jakarta.json.api" optional="true"/>
<module name="jakarta.persistence.api"/>
<module name="jakarta.transaction.api"/>
<module name="jakarta.validation.api"/>
<module name="jakarta.xml.bind.api"/>
<module name="org.antlr"/>
<module name="org.apache.commons.collections"/>
<module name="org.dom4j"/>
<module name="org.jboss.as.jpa.spi"/>
<module name="org.jboss.logging"/>
<module name="org.jboss.vfs"/>
</dependencies>
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="jee2ap102-ejb-pu" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>jdbc/jee2ap102</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-server" value="JBoss"/>
<property name="eclipselink.weaving" value="static"/>
</properties>
</persistence-unit>
</persistence>
我对WildFly 26和27使用了相同的eclipselink-2.7.8.jar。我确信类org.eclipse.persistence.jpa.PersistenceProvider
在那个jar中,但即使这样WildFly 27也找不到它。
2022年11月19日编辑
我也试过使用eclipselink 3.0.3。它也失败了。这是错误消息:
INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 18) WFLYJPA0003: Starting Persistence Unit Service 'jee2ap102-ear.ear/jee2ap102-ejb.jar#jee2ap102-ejb-pu'
ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 18) MSC000001: Failed to start service jboss.persistenceunit."jee2ap102-ear.ear/jee2ap102-ejb.jar#jee2ap102-ejb-pu": org.jboss.msc.service.StartException in service jboss.persistenceunit."jee2ap102-ear.ear/jee2ap102-ejb.jar#jee2ap102-ejb-pu": java.lang.NoClassDefFoundError: java/rmi/RemoteException
at org.jboss.as.jpa@27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:199)
at org.jboss.as.jpa@27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:129)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.wildfly.security.elytron-base@2.0.0.Final//org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:664)
at org.jboss.as.jpa@27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:214)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.JBossThread.run(JBossThread.java:513)
Caused by: java.lang.NoClassDefFoundError: java/rmi/RemoteException
at org.eclipse.persistence//org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactoryImpl(PersistenceProvider.java:331)
at org.eclipse.persistence//org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:316)
at org.jboss.as.jpa@27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:367)
at org.jboss.as.jpa@27.0.0.Final//org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:191)
... 10 more
Caused by: java.lang.ClassNotFoundException: java.rmi.RemoteException from [Module "org.eclipse.persistence" from local module loader @fb9c7aa (finder: local module finder @4c398c80 (roots: C:\wildfly-27.0.0.Final\modules,C:\wildfly-27.0.0.Final\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:200)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 14 more
此时,我尝试添加java.management.rmi和java.rmi作为模块依赖项,但它们都不起作用。
我将非常感谢任何帮助解决这个问题。
1条答案
按热度按时间63lcw9qa1#
看一看changelog:
使用Eclipselink 3.0.0,因为它支持Jakarta EE 9,其中所有名称空间都已调整为
jakarta.*
,而不是旧的javax.*
。