Problem upgrading Wildfly 10 from Java 8 to Java 11

914 views Asked by At

I'm upgrading my hosted system to use Java 11 instead of Java 8. My web apps are deployed onto Wildfly 10. When I change the config file and restart Wildfly, I get an error like this

at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.ClassNotFoundException: jdk.internal.reflect.ConstructorAccessorImpl from [Module "org.infinispan:main" from local module loader @502a16d9 (finder: local module finder @122003cc (roots: /opt/wildfly10/modules,/opt/wildfly10/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)

I've seen a few reasons for this, like Java 9 introducing modules and also the packages being renamed from something like javax.reflect.* to jdk.internal.reflect.* but I haven't really found any good workarounds for this. All this works on my Wildfly 15 at home on localhost, but I'm loathe to go through the process of re-deploying all the apps and the Wildfly modules and any other configs that I have. So, my question is this:

  1. What sort of workaround will fix this?
  2. or is just easier to get a later version of Wildfly installed and go through all of that work?
1

There are 1 answers

8
skomisa On

Wildfly 10 was released in January 2016, but Java 11 was not released until September, 2018, over two and a half years later. So Wildfly 10 was never tested against Java 11, and does not support the use of Java 11.

Since you are running on old releases of both Wildfly and Java you are inevitably going to have to upgrade both at sometime, and the sooner the better, if only to avoid security vulnerabilities.

As you point out, Wildfly 15 runs fine using Java 11, but the good news is that it also runs fine on Java 8: "WildFly 15 also is heavily tested and runs well on Java 8". So a simple and safe approach would be:

  • Stay on Java 8, and upgrade to Wildfly 15. That combination is supported.
  • Once Wildfly 15 is running fine on Java 8 you can upgrade to Java 11.

Additional Notes:

  • From the Wildfly 15 release documentation, note that "WildFly runs on Java 11 in classpath mode". See What is "classpath mode", as seen in WildFly documentation? for more information on that.
  • Consider upgrading to a more recent release of Wildfly than Wildfly 15. From WildFly Release Plans for 2022: "We don’t plan to support Java SE 8 in WildFly 27. The WildFly 26.1 releases will be the last that support SE 8. WildFly 27 will require SE 11 or later."
  • So given all that, you might even consider this sequence : Stay on Java 8 > Upgrade to Wildfly 26.1 which supports Java 8 > Upgrade to Java 11, which is also supported by Wildfly 26.1 > Eventually upgrade to some Wildfly27+ release which runs on Java 11, but not Java 8.
  • I don't see a viable approach for you to upgrade Java before upgrading Wildfly.
  • I don't see any benefit in looking for a "workaround". Since you must upgrade Java and Wildfly anyway, even if there is a short term workaround, implementing it would just be adding to your overall workload.