2

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
Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165
  • where does the module `deployment.sdi.war` reside? Is it within `javaee.api`? Is it `transitive`? – Naman Dec 20 '18 at 08:07
  • @nullpointer this is my war, I deploy it to the WildFly. I don't have a module explicitly declared for it. – Evandro Pomatti Dec 20 '18 at 10:38
  • Its hard to tell without looking at `javaee.api` module description or dependencies. *I don't have a module explicitly declared* ... I would still assume its there on the modulepath(maybe as an automatic module) and then JBoss is trying to access the HttpClient class using Service loaders I guess where it's failing. But its still not very clear. – Naman Dec 20 '18 at 10:50
  • @nullpointer yes `javaee.api` it is an automatic module, because it is a plain 3rd party jar. How can I add http client as a dependency to it? I have looked already but can't find anything. – Evandro Pomatti Dec 20 '18 at 11:13
  • The question is why do you want to do that? If the classes of `jdk.incubator.httpclient` modules are supposed to be used in `mymodule`, then just include it in the same module, and if the module `javaee.api` was supposed to be using it, it should have a dependency on the same. Also, could you update the command line for the execution in the question to complete it? – Naman Dec 20 '18 at 11:32
  • @nullpointer I don't know why WildFly is doing it, just trying to find a workaround. I've added the command lin.l – Evandro Pomatti Dec 20 '18 at 12:33
  • Not much I could help with further. Seems like JBoss is [logging the error in terms of their module](https://github.com/jboss-modules/jboss-modules/blob/1.x/src/main/java/org/jboss/modules/ModuleClassLoader.java#L255). Just to confirm if the module you added using `requires jdk.incubator.httpclient` got resolved or not, you can at runtime [use `--show-module-resolution`](https://stackoverflow.com/questions/48339598/list-the-modules-resolved-during-the-application-startup) as well. You can then get rid of the VM argument added by you.Considering you are using modulepath and not classpath there. – Naman Dec 20 '18 at 12:40
  • 1
    @nullpointer definitely loading, updated my question with the logs. I'll think about reporting this as a bug in Jira. Problem is that we need to run in 32-bits and there is no JDK11 for that platform. – Evandro Pomatti Dec 20 '18 at 13:08

1 Answers1

0

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

Evandro Pomatti
  • 13,341
  • 16
  • 97
  • 165