Spring WLP (WebSphere Liberty) 上的引导部署引发 CWWKC0044W 错误

Spring Boot deployment on WLP (WebSphere Liberty) throws CWWKC0044W error

我有一个 Spring Boot 应用程序,它通过 Spring Boot Gradle Plugin[=49 运行良好=],或java -jar myApp.war命令。

但是,如果我尝试在 WebSphere Liberty 应用程序服务器上部署它,我会收到以下错误:

[WARNING ] CWWKC0044W: An exception occurred while scanning class and annotation data. The exception was java.lang.RuntimeException
        at org.objectweb.asm.ClassVisitor.visitModule(ClassVisitor.java:148)
        at [internal classes]
.

此外,此错误导致 Spring Boot 开始记录 DEBUG 严重性,即使它配置为 INFO, 或 WARN.

谁能告诉我根本原因,或者如何进行更深入的调查?

我正在使用以下版本:

  • Spring 开机:2.0.0.M7
  • WLP: 17.0.0.4
  • Java(构建):祖鲁 1.8.0_152
  • Java (WLP): IBM 8.0.5.6

和以下依赖项:

dependencies {
    implementation "org.springframework.boot:spring-boot-starter-web:2.0.0.M7"
    implementation "org.springframework.boot:spring-boot-starter-thymeleaf:2.0.0.M7"

    providedRuntime "org.springframework.boot:spring-boot-starter-tomcat:2.0.0.M7"
}

我尝试了不同版本的 Spring Boot (1.5.9) 和 WLP (17.0 .0.3),但错误没有改变。


更新:错误不存在于Spring Boot 1.5.9.

您需要包含 Liberty spring 启动器,并排除 Tomcat 启动器(因为您使用的是 Liberty 而不是 Tomcat)。

您的依赖项应如下所示:

dependencies {
  ...
  // Include liberty and exclude tomcat
  compile('io.openliberty.boot:liberty-spring-boot-starter:0.5.0.M1')
  compile('org.springframework.boot:spring-boot-starter-web') {
    exclude module: "spring-boot-starter-tomcat"
  }
  ...
}

有关使用 Liberty+ 的基本 HelloServlet 的更详细演练Spring,请查看 Tom Watson 的博客 post:Open Liberty Spring Boot Starter

我能够通过排除 Log4j 传递依赖来消除错误。有必要从每个 spring-boot-starter-* 依赖项中删除它(在我的例子中是 webthymeleaf)。因此,我在全球范围内排除了它:

configurations {
    implementation {
        exclude group: 'org.apache.logging.log4j'
    }
}

我用的是Gradle4,所以配置是implementation。对于旧版本,它应该是 compile

但是,我仍然不知道根本原因是什么,所以一些解释会很好。我怀疑 older/incompatible 版本的 Java.