Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 763
Kikuich Avatar asked Dec 02 '20 01:12

Kikuich


1 Answers

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 i.e., 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'
}

like image 92
Prasanth Rajendran Avatar answered Nov 05 '22 02:11

Prasanth Rajendran