Springboot WildFly 10部署错误jdk。找不到不支持的模块 [英] Springboot Wildfly 10 deployment error jdk.unsupported module not found

查看:53
本文介绍了Springboot WildFly 10部署错误jdk。找不到不支持的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有Java 1.8的Springboot v2项目,当我尝试在WildFly 10上部署我的Sprringboot项目时,不断收到此错误

19:12:25,295 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "HealthCheck.war")]) - failure description: {
    "WFLYCTL0080: Failed services" => {"jboss.module.service."deployment.HealthCheck.war".main" => "org.jboss.msc.service.StartException in service jboss.module.service."deployment.HealthCheck.war".main: WFLYSRV0179: Failed to load module: deployment.HealthCheck.war:main
    Caused by: org.jboss.modules.ModuleNotFoundException: jdk.unsupported:main"},
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.module.service."deployment.HealthCheck.war".main"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined

我已经创建了一个joss-ployment-structure.xml并在其中添加了";jdk.unsupport";依赖项,我还尝试将该依赖项添加到MANIFEST.MF中,还尝试在maven-war插件下添加缺少的";jdk.unsupport";依赖项,但没有成功。

推荐答案

这是由于Spring-core5.3.*中引入的breaking change,导致上述问题的Spring-core库的变化是commit。如果您使用Spring boot版本2.4.*,那么您肯定会面临这个问题,因为它拉出了Spring-core5.3.*的传递依赖。务实的方法是在可能的情况下升级WildFly版本(最新版本是22.0.1.Finalwildfly 10.1.0.Final 已于近5年前于2016年8月19日发布)或将您的Spring Boot版本降级为'2.3.*.RELEASE'


解决方法 对于那些无法升级WildFly服务器但处于使用最新Spring版本(5.3.*)的用户,请遵循下面的解决方案。实际问题是Spring-core 5.3.x包含MANIFEST.MF文件条目Dependencies: jdk.unsupported。如果我们从JAR的MANIFEST.MF文件中删除特定条目,我们就可以使用Wildfly10.x版本本身中的Spring-core 5.3.x。

要修补5.3.x并将其拉入类路径,需要执行以下步骤:

  1. 作为JAR文件本身,归档使用7-Zip/winrar或任何文件归档实用工具打开它。打开MANIFEST.MF,删除最后一行Dependencies: jdk.unsupported并保存更改。
  2. 将修补后的JAR文件放入您的项目文件夹,即lib
  3. 在项目级别排除Spring-core 5.3.x,强制使用构建工具从项目目录中使用Spring-core 5.3.x的补丁程序库,并将其添加到您的类路径中。我已经为gradle用户提供了代码片段
dependencies {
    //Adding the patched jar into the classpath from a project directory
    compile files('lib/spring-core-5.3.3.jar')
}

configurations.all {
    //Excluding the spring-core-5.3.3.jar at the project level
    exclude group: 'org.springframework', module: 'spring-core'
}

这篇关于Springboot WildFly 10部署错误jdk。找不到不支持的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆