WildFly 26/27迁移Mojarra至MyFaces 4.0.0.RC2遇部署错误求助
WildFly切换MyFaces部署失败及集群模块依赖问题排查
环境与背景
- 运行环境:WildFly 26.1.2.Final / WildFly Preview-27.0.0.Beta1,搭配Jakarta 10.0
- 问题起因:Mojarra 4.0.0.SP01与PrimeFaces 7.x-12.x的TabView组件存在兼容性问题,计划迁移至MyFaces
已执行操作
执行官方指南中的CLI命令切换默认JSF实现:
./jboss-cli.sh -c "/subsystem=jsf/:write-attribute(name=default-jsf-impl-slot,value=myfaces-4.0.0-RC2)"
命令执行成功,提示需重载服务器,但部署EAR包时出现错误。
部署错误日志
14:34:28,769 WARN [org.jboss.as.jsf] (MSC service thread 1-2) WFLYJSF0005: Unknown Jakarta Server Faces version 'myfaces-4.0.0-RC2'. Default version 'myfaces-4.0.0-RC2' will be used instead. 14:34:28,770 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."NOTiFYmoto.ear".DEPENDENCIES: org.jboss.msc.service.StartException in service jboss.deployment.unit."NOTiFYmoto.ear".DEPENDENCIES: WFLYSRV0153: Failed to process phase DEPENDENCIES of deployment "NOTiFYmoto.ear" at org.jboss.as.server@19.0.0.Beta18//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:833) Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJSF0014: Default Jakarta Server Faces implementation slot 'myfaces-4.0.0-RC2' is invalid at org.jboss.as.jsf@27.0.0.Beta1//org.jboss.as.jsf.deployment.JSFDependencyProcessor.deploy(JSFDependencyProcessor.java:94) at org.jboss.as.server@19.0.0.Beta18//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:182) ... 8 more 14:34:28,772 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 1) WFLYCTL0013: Operation ("add") failed - address: [("deployment" => "NOTiFYmoto.ear")] - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"NOTiFYmoto.ear\".DEPENDENCIES" => "WFLYSRV0153: Failed to process phase DEPENDENCIES of deployment \"NOTiFYmoto.ear\" Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJSF0014: Default Jakarta Server Faces implementation slot 'myfaces-4.0.0-RC2' is invalid"}} 14:34:28,773 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 1) WFLYCTL0013: Operation ("add") failed - address: [("deployment" => "NOTiFYmoto.ear")] - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"NOTiFYmoto.ear\".DEPENDENCIES" => "WFLYSRV0153: Failed to process phase DEPENDENCIES of deployment \"NOTiFYmoto.ear\" Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJSF0014: Default Jakarta Server Faces implementation slot 'myfaces-4.0.0-RC2' is invalid"}} 14:34:28,775 ERROR [org.jboss.as.server] (External Management Request Threads -- 1) WFLYSRV0021: Deploy of deployment "NOTiFYmoto.ear" was rolled back with the following failure message: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"NOTiFYmoto.ear\".DEPENDENCIES" => "WFLYSRV0153: Failed to process phase DEPENDENCIES of deployment \"NOTiFYmoto.ear\" Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJSF0014: Default Jakarta Server Faces implementation slot 'myfaces-4.0.0-RC2' is invalid"}}
额外发现:集群模块仍引用Mojarra
- 路径1:
/usr/local/Cellar/wildfly-as/wildfly-preview-27.0.0.Beta1.MyFaces/modules/system/layers/base/org/wildfly/extension/clustering/web
引用内容:<module name="org.wildfly.clustering.faces.mojarra"/> - 路径2:
/usr/local/Cellar/wildfly-as/wildfly-preview-27.0.0.Beta1.MyFaces/modules/system/layers/base/org/wildfly/extension/clustering
引用内容:<module name="org.wildfly.clustering.faces.mojarra" xmlns="urn:jboss:module:1.9"> <properties> <property name="jboss.api" value="private"/> </properties> <resources> <resource-root path="wildfly-clustering-faces-mojarra-27.0.0.Beta1.jar"/>
解决思路与建议
验证MyFaces插槽名称正确性
- 先通过CLI命令查看服务器中已安装的JSF插槽:
./jboss-cli.sh -c "/subsystem=jsf/:read-attribute(name=installed-jsf-impl-slots)" - 确认返回结果中是否包含
myfaces-4.0.0-RC2,若不存在,需检查MyFaces模块是否正确部署到WildFly的模块目录中,或使用服务器已支持的MyFaces版本插槽名称。
- 先通过CLI命令查看服务器中已安装的JSF插槽:
修复集群模块依赖
- WildFly的集群模块默认绑定Mojarra,切换到MyFaces后需替换为对应的MyFaces集群模块:
- 检查是否存在
org.wildfly.clustering.faces.myfaces模块,若存在,将路径1和路径2中的org.wildfly.clustering.faces.mojarra替换为该模块名称。 - 若不存在对应模块,需下载或编译WildFly的MyFaces集群适配模块,放置到对应模块目录并更新模块引用配置。
- 检查是否存在
- WildFly的集群模块默认绑定Mojarra,切换到MyFaces后需替换为对应的MyFaces集群模块:
检查EAR包内的JSF依赖
- 确认EAR包中的WAR模块是否包含了重复的JSF实现依赖,若存在,需移除这些依赖,确保使用服务器提供的MyFaces模块。
尝试使用正式版MyFaces
- 当前使用的MyFaces为RC版本,可能存在兼容性问题,建议切换到MyFaces 4.0.x正式版,再更新CLI命令中的插槽名称进行测试。
内容的提问来源于stack exchange,提问作者NOTiFY
相关产品推荐
相关产品推荐

