Wildfly - 10.x - WELD-001414:Bean 名称不明确。名称 csfFLOWDISCOVERYCDIHELPER 解析为 bean

Wildfly - 10.x - WELD-001414: Bean name is ambiguous. Name csfFLOWDISCOVERYCDIHELPER resolves to beans

我正在尝试在 WildFly 10.1.0 服务器中部署 .war 文件。早些时候我在 JBoss 7.1 上 运行 它并且我们让它工作正常。但是现在,当我尝试在 WildFly 服务器中部署应用程序时,我遇到了导致部署失败的异常集。

09:05:02,630 SEVERE [javax.enterprise.resource.webcontainer.jsf.application.view] (MSC service thread 1-3) Unable to obtain CDI 1.1 utilities for Mojarra
09:05:02,650 SEVERE [javax.enterprise.resource.webcontainer.jsf.flow] (MSC service thread 1-3) Unable to obtain CDI 1.1 utilities for Mojarra
09:05:02,897 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."MyApplication.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."MyApplication.war".WeldStartService: Failed to start service
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414: Bean name is ambiguous. Name csfFLOWDISCOVERYCDIHELPER resolves to beans:
  - Managed Bean [class com.sun.faces.flow.FlowDiscoveryCDIHelper] with qualifiers [@Default @Named @Any],
  - Managed Bean [class com.sun.faces.flow.FlowDiscoveryCDIHelper] with qualifiers [@Default @Named @Any]
        at org.jboss.weld.bootstrap.ConcurrentValidator.doWork(ConcurrentValidator.java:134)
        at org.jboss.weld.bootstrap.ConcurrentValidator.doWork(ConcurrentValidator.java:130)
        at org.jboss.weld.executor.IterativeWorkerTaskFactory.call(IterativeWorkerTaskFactory.java:63)
        at org.jboss.weld.executor.IterativeWorkerTaskFactory.call(IterativeWorkerTaskFactory.java:56)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
        at org.jboss.threads.JBossThread.run(JBossThread.java:320)

09:05:02,971 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "MyApplication.war")]) - failure description: {
    "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"MyApplication.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MyApplication.war\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414: Bean name is ambiguous. Name csfFLOWDISCOVERYCDIHELPER resolves to beans:
  - Managed Bean [class com.sun.faces.flow.FlowDiscoveryCDIHelper] with qualifiers [@Default @Named @Any],
  - Managed Bean [class com.sun.faces.flow.FlowDiscoveryCDIHelper] with qualifiers [@Default @Named @Any]"},
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"MyApplication.war\".WeldStartService"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
09:05:03,041 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "MyApplication.war" (runtime-name : "MyApplication.war")
09:05:03,068 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."MyApplication.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."MyApplication.war".WeldStartService: Failed to start service

我真的不明白这个异常指向哪里。错误也不清楚。我发现了其他关于此错误的 SO Post,但那些是 GlassFish 服务器。有没有人遇到过类似类型的问题并解决了这个问题。如果有人指出正确的方向或对此有任何解决方案,我将非常感激。

应用程序中的 jsf-api 和 jsf-impl jar 版本与应用服务器实现的版本不同会导致此问题。从 WEB-INF/lib 文件夹中删除应用程序提供的 jar 并使用服务器提供的 jar 可以解决问题。