简体   繁体   中英

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

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.

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 . 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.* . 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' .


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.* ). The actual issue is the Spring-core 5.3.x contains the MANIFEST.MF file entry 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.

To patch the 5.3.x and pull it into the classpath, the following steps are required:

  1. As the jar file itself an archive opens it with 7-Zip / winrar or with any file archive utility tools. Open the MANIFEST.MF and remove the last line Dependencies: jdk.unsupported and save the change.
  2. Put the patched jar file into your project folder ie, 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. I have provided the snippet for gradle users
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 found a better solution, based on creating a new fake module named jdk.unsupported on jboss or wildfly.

In my case, I can't upgrade the JBoss EAP 7.1, and I want to keep updated to the latest version of Spring.

So what I did is to create a new fake module under modules/system/layers/base folder and it worked like a charm!

We are using wildfly 11. and the max version of spring boot we could use is 2.3.11 without this issue. starting from 2.3.12, this error appears.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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