12

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.

James R. Perkins
  • 16,800
  • 44
  • 60
Kikuich
  • 121
  • 1
  • 1
  • 4
  • There is no module `jdk.unsupported` in WildFly 10. Did you create the module? – James R. Perkins Dec 03 '20 at 19:42
  • No. I believe it's something that was introduced on Java 9. I'm using Java 8 so I'm not sure which part of the code is looking for it. – Kikuich Dec 04 '20 at 23:43
  • That exception is coming from JBoss Modules so it's attempting to load that module. Are you sure you're using WildFly 10? If you've got a `jboss-deployment-structure.xml` or a `MANIFEST.MF` entry with that module that is not correct. – James R. Perkins Dec 07 '20 at 16:07

4 Answers4

28

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'
}

Prasanth Rajendran
  • 4,570
  • 2
  • 42
  • 59
21

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!

Marc Gil Sendra
  • 819
  • 2
  • 9
  • 22
  • Can you describe how you did this? – Jason Aug 03 '21 at 22:42
  • 10
    You should create a new module for JBoss. It's easy to do. 1. Create a new folder folder under *$JBOSS_PATH/modules/system/layers/base* named *jdk/unsupported/main* 2. Create a new file under the *main* folder named *module.xml* with the following content: ´´´´ ´´´´ – Marc Gil Sendra Aug 06 '21 at 06:27
  • Thx a lot, that's an nice and easy solution to ensure app compatibility to older JBoss versions. – chux Jan 18 '22 at 09:26
  • I've applied your idea and works perfect! Thanks – Eduardo Apr 29 '22 at 11:25
1

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.

Aviral Ahuja
  • 205
  • 1
  • 2
  • 14
0

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.