简体   繁体   English

springboot Wildfly 10部署报错jdk.unsupported module not found

[英]Springboot Wildfly 10 deployment error jdk.unsupported module not found

I have a Springboot v2 project with Java 1.8 and when I try to deploy my springboot project on Wildfly 10, I keep getting this error我有一个带有 Java 1.8 的 Springboot v2 项目,当我尝试在 Wildfly 10 上部署我的 springboot 项目时,我不断收到此错误

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

I have already created a jboss-deployment-structure.xml and added the "jdk.unsupported" dependency there, I have also tried adding that to the MANIFEST.MF and I have also tried adding the missing "jdk.unsupported" dependency on the pom file under the maven-war plugin but no luck.我已经创建了一个 jboss-deployment-structure.xml 并在那里添加了“jdk.unsupported”依赖项,我还尝试将其添加到 MANIFEST.MF 中,我还尝试添加缺少的“jdk.unsupported”依赖项pom 文件在 maven-war 插件下,但没有运气。

This is due to breaking change , which is introduced in Spring-core 5.3.* , the change in the Spring-core library that causes the above issue is commit .这是由于 Spring-core 5.3.*中引入的破坏性 更改,导致上述问题的 Spring-core 库中的更改是commit If you use Spring boot version 2.4.* then surely you will face this issue as it pulls the transitive dependency of Spring-core 5.3.* .如果您使用 Spring 引导版本2.4.*那么您肯定会遇到这个问题,因为它会拉取 Spring-core 5.3.*的传递依赖。 The pragmatic approach is either to upgrade the wildfly version if possible(The latest version is 22.0.1.Final , the wildfly 10.1.0.Final was released nearly 5 years back on Aug 19, 2016) or downgrade your Spring boot version to '2.3.*.RELEASE' .务实的方法是尽可能升级 wildfly 版本(最新版本为22.0.1.Finalwildfly 10.1.0.Final于 2016 年 8 月 19 日发布近 5 年)或将 Spring 引导版本降级为'2.3.*.RELEASE'


Workaround Please follow the below workaround for those who cannot upgrade the Wildfly server but in the situation to use the latest Spring version( 5.3.* ).解决方法 对于无法升级 Wildfly 服务器但在使用最新 Spring 版本( 5.3.* )的情况下,请按照以下解决方法。 The actual issue is the Spring-core 5.3.x contains the MANIFEST.MF file entry Dependencies: jdk.unsupported .实际问题是 Spring-core 5.3.x 包含MANIFEST.MF文件条目Dependencies: jdk.unsupported If we remove the particular entry from the jar's MANIFEST.MF file we can use the Spring-core 5.3.x in the Wildfly 10.X version itself.如果我们从 jar 的 MANIFEST.MF 文件中删除特定条目,我们可以在 Wildfly 10.X 版本本身中使用 Spring-core 5.3.x。

To patch the 5.3.x and pull it into the classpath, the following steps are required:要修补 5.3.x 并将其拉入类路径,需要执行以下步骤:

  1. As the jar file itself an archive opens it with 7-Zip / winrar or with any file archive utility tools.作为 jar 文件本身的存档,使用7-Zip / winrar或任何文件存档实用工具打开它。 Open the MANIFEST.MF and remove the last line Dependencies: jdk.unsupported and save the change.打开MANIFEST.MF并删除最后一行Dependencies: jdk.unsupported并保存更改。
  2. Put the patched jar file into your project folder ie, lib将修补后的 jar 文件放入您的项目文件夹,即lib
  3. Exclude the Spring-core 5.3.x at the project level and enforce the build tool to use the patched library of Spring-core 5.3.x from the project directory and add it to your classpath.在项目级别排除Spring-core 5.3.x并强制构建工具使用项目目录中的Spring-core 5.3.x修补库并将其添加到您的类路径中。 I have provided the snippet for gradle users我为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'
}

I faced exactly same issue and resolved it by upgrading wildfly 10 to 20 with java 8. My spring boot version was 2.4.0 Alternatively, i degraded my spring boot version to 1.5.8.RELEASE and was able to successfully run on wildfly 10. I faced exactly same issue and resolved it by upgrading wildfly 10 to 20 with java 8. My spring boot version was 2.4.0 Alternatively, i degraded my spring boot version to 1.5.8.RELEASE and was able to successfully run on wildfly 10.

I found a better solution, based on creating a new fake module named jdk.unsupported on jboss or wildfly.我找到了一个更好的解决方案,基于在 jboss 或 wildfly 上创建一个名为jdk.unsupported的新假模块。

In my case, I can't upgrade the JBoss EAP 7.1, and I want to keep updated to the latest version of Spring.就我而言,我无法升级 JBoss EAP 7.1,我想保持更新到最新版本的 Spring。

So what I did is to create a new fake module under modules/system/layers/base folder and it worked like a charm!所以我所做的是在modules/system/layers/base文件夹下创建一个新的假模块,它就像一个魅力!

We are using wildfly 11. and the max version of spring boot we could use is 2.3.11 without this issue.我们正在使用 wildfly 11。我们可以使用的 spring 引导的最大版本是 2.3.11,没有这个问题。 starting from 2.3.12, this error appears.从2.3.12开始,出现这个错误。

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

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