我目前正在使用Open Liberty 18.0.0.4及其Microprofile支持。当我尝试构建包含mpHealth-1.0功能的独立可运行Jar时,启动失败并显示
[ERROR ] CWWKF0033E: The singleton features com.ibm.websphere.appserver.javax.servlet-3.1 and com.ibm.websphere.appserver.javax.servlet-4.0 cannot be loaded at the same time. The configured features mpHealth-1.0 and jaxrs-2.1 include one or more features that cause the conflict. Your configuration is not supported; update server.xml to remove incompatible features.
[ERROR ] CWWKF0033E: The singleton features com.ibm.websphere.appserver.javax.annotation-1.2 and com.ibm.websphere.appserver.javax.annotation-1.3 cannot be loaded at the same time. The configured features mpHealth-1.0 and jaxrs-2.1 include one or more features that cause the conflict. Your configuration is not supported; update server.xml to remove incompatible features.
[ERROR ] CWWKF0033E: The singleton features com.ibm.websphere.appserver.javaeeCompatible-8.0 and com.ibm.websphere.appserver.javaeeCompatible-7.0 cannot be loaded at the same time. The configured features jsonb-1.0 and mpHealth-1.0 include one or more features that cause the conflict. Your configuration is not supported; update server.xml to remove incompatible features.
[ERROR ] CWWKF0033E: The singleton features com.ibm.websphere.appserver.javax.cdi-2.0 and com.ibm.websphere.appserver.javax.cdi-1.2 cannot be loaded at the same time. The configured features jsonb-1.0 and mpHealth-1.0 include one or more features that cause the conflict. Your configuration is not supported; update server.xml to remove incompatible features.
我正在使用jaxrs-2.1和jsonb-1.0,并且一切正常。添加mpHealth-1.0功能后,我立即收到上述错误。这是server.xml的相关代码段:
<featureManager>
<feature>jaxrs-2.1</feature>
<feature>jsonb-1.0</feature>
<feature>mpHealth-1.0</feature>
</featureManager>
这就是开始的Jar在结束时说的(但没有可用的服务):
[AUDIT ] CWWKF0012I: The server installed the following features: [jsonb-1.0, servlet-4.0, jndi-1.0, mpHealth-1.0, json-1.0, cdi-1.2, jsonp-1.1, jaxrsClient-2.1, jaxrs-2.1].
答案 0 :(得分:1)
之所以会发生此错误,是因为并非所有OpenLiberty功能都相互兼容,并且如果启用了冲突功能,则会出现错误,指出哪些功能发生冲突。应该可以通过在server.xml中启用其他功能来解决该问题,以帮助运行时消除应该启用哪些功能的歧义。
功能冲突的两个主要原因是:
foo-1.0
和foo-2.0
)cdi-1.2
和EE 8中的jaxrs-2.1
)要分解已启用功能的功能依赖性,它看起来像这样:
- jsonb-1.0 -> jsonp-1.1
- jaxrs-2.1 -> cdi-2.0
-> servlet-4.0
- mpHealth-1.0 -> cdi-1.2 (tolerates cdi-2.0)
看到这些错误的原因是因为OpenLiberty功能管理器没有足够的证据知道它可以故障转移到mpHealth-1.0 -> cdi-2.0
依赖项。
要解决此问题,您有两种选择:
cdi-2.0
功能。这应该有助于消除功能管理器的歧义,以便它可以故障转移到mpHealth-1.0 -> cdi-2.0
依赖项。microProfile-2.0
便利功能,而不是启用单个功能。在这里,您不必担心功能冲突,但是它将在运行时加载更多功能(例如MP Metrics,MP Config,MP Fault Tolerance等),这将招致一些额外的启动时间和内存占用成本。 li>