简体   繁体   English

包括 mpHealth 功能会破坏 Open Liberty 中的独立应用程序

[英]Including mpHealth feature breaks standalone application in Open Liberty

I'm currently playing with Open Liberty 18.0.0.4 and its Microprofile support.我目前正在使用 Open Liberty 18.0.0.4 及其 Microprofile 支持。 When I try to build a standalone runnable Jar which includes the mpHealth-1.0 feature, startup fails with当我尝试构建包含 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.

I'm using jaxrs-2.1 and jsonb-1.0 and everything works fine.我正在使用 jaxrs-2.1 和 jsonb-1.0,一切正常。 As soon as I add the mpHealth-1.0 feature I get the above errors.一旦我添加了 mpHealth-1.0 功能,我就会收到上述错误。 Here's the relevant snippet of the server.xml:这是 server.xml 的相关片段:

    <featureManager>
        <feature>jaxrs-2.1</feature>
        <feature>jsonb-1.0</feature>
        <feature>mpHealth-1.0</feature>
    </featureManager>

And this is what the started Jar says at then end (but no service will be available):这就是开始的 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].

This error occurs because not all OpenLiberty features are compatible with each other, and if you enable conflicting features you get an error indicating which features conflict.发生此错误的原因是并非所有 OpenLiberty 功能都相互兼容,如果启用冲突功能,您会收到一个错误,指示哪些功能发生冲突。 It should be resolvable by enabling additional features in your server.xml to help the runtime disambiguate which features should be enabled.它应该可以通过在 server.xml 中启用其他功能来解决,以帮助运行时消除应该启用哪些功能的歧义。

The two main reasons features conflict are:功能冲突的两个主要原因是:

  1. Two versions of the same feature try to be enabled (eg foo-1.0 and foo-2.0 )尝试启用相同功能的两个版本(例如foo-1.0foo-2.0
  2. A mix of Java EE 7 and Java EE 8 features are enabled (eg cdi-1.2 from EE 7 and jaxrs-2.1 from EE 8)启用了 Java EE 7 和 Java EE 8 功能的混合(例如,来自 EE 7 的jaxrs-2.1 cdi-1.2和来自 EE 8 的jaxrs-2.1

To break down the feature dependencies of what you have enabled, it looks something like this:要分解您启用的功能的依赖关系,它看起来像这样:

- 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)

The reason you are seeing these errors is because the OpenLiberty feature manager does not have sufficient evidence to know that it can failover to the mpHealth-1.0 -> cdi-2.0 dependency.您看到这些错误的原因是 OpenLiberty 功能管理器没有足够的证据知道它可以故障转移到mpHealth-1.0 -> cdi-2.0依赖项。

To fix this, you have two options:要解决此问题,您有两个选择:

  1. Enable the cdi-2.0 feature in server.xml.在 server.xml 中启用cdi-2.0功能。 This should help to disambiguate for the feature manager so it can failover to the mpHealth-1.0 -> cdi-2.0 dependency.这应该有助于消除功能管理器的歧义,以便它可以故障转移到mpHealth-1.0 -> cdi-2.0依赖项。
  2. Instead of enabling individual features, enable the microProfile-2.0 convenience feature.启用microProfile-2.0便利功能,而不是启用单个功能。 Here you won't have to worry about feature conflicts, but it will load more features into the runtime (eg MP Metrics, MP Config, MP Fault Tolerance, etc), which will incur some additional startup time and memory footprint cost.在这里您不必担心功能冲突,但它会将更多功能加载到运行时(例如 MP Metrics、MP 配置、MP Fault Tolerance 等),这将导致一些额外的启动时间和内存占用成本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM