Search code examples
javawildflyjava-modulemodule-infojava-http-client

WildFly Service Module Loader - ClassNotFound on jdk.incubator.http.HttpClient


I am using WildFly15 with JDK 10 to build an application with the new HTTP Client and when I declare the jdk.incubator.httpclient as the only and single requirement in my module it works fine. (I can't go to JDK11 because we need to run in 32-bits).

This is the complete command line in two sets of values (I copied it from Eclipse):

Program arguments:
-mp "D:\ambientes\oboticario\itsmconn2\wildfly-15.0.0.Final\modules" org.jboss.as.standalone -b localhost --server-config=standalone-full.xml -Djboss.server.base.dir=D:\ambientes\oboticario\itsmconn2\wildfly-15.0.0.Final\standalone

VM Arguments:
"-Dprogram.name=JBossTools: WildFly 15 at localhost" -server -Xms64m -Xmx512m -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true "-Dorg.jboss.boot.log.file=D:\ambientes\oboticario\itsmconn2\wildfly-15.0.0.Final\standalone\log\boot.log" "-Dlogging.configuration=file:D:\ambientes\oboticario\itsmconn2\wildfly-15.0.0.Final\standalone\configuration\logging.properties" "-Djboss.home.dir=D:\ambientes\oboticario\itsmconn2\wildfly-15.0.0.Final" -Dorg.jboss.logmanager.nocolor=true -Djboss.bind.address.management=localhost --add-modules jdk.incubator.httpclient 

I'm properly adding adding --add-modules jdk.incubator.httpclient to the JVM start.

module mymodule {
    requires jdk.incubator.httpclient;
    //requires javaee.api;
}

However, when I remove the comment for the javaee.api module, adding it as a requirement, I get ClassNotFoundException:

module mymodule {
    requires jdk.incubator.httpclient;
    requires javaee.api;
}

Since I use the HTTP Client API inside my EJBs, could that be the reason why javaee.api breaks the build? How to fix it?

Caused by: java.lang.ClassNotFoundException: jdk.incubator.http.HttpClient from [Module "deployment.sdi.war" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:255)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:410)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    ... 18 more

Starting java with option use --show-module-resolution confirms that the module is loaded:

...
root jdk.incubator.httpclient jrt:/jdk.incubator.httpclient
...

and also after this WildFLy prints the message: WARNING: Using incubator modules: jdk.incubator.httpclient

Solution

  • This seems to be a bug in WildFly. We decided to use a new virtual machine with 64-bits platform and move to JDK11.