1

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?
Gary Kephart
  • 4,860
  • 5
  • 39
  • 52

1 Answers1

1

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.
skomisa
  • 16,436
  • 7
  • 61
  • 102
  • Thanks for the info. I can't stay on Java 8 as I'm developing an app that requires Java 11. I am running Wildfly 15 on my localhost, but I can only upgrade to Wildfly 13 on my remote host, at least as far as I can see. I'm strongly leaning towards upgrading my remote host to Wildfly 13. – Gary Kephart Mar 17 '23 at 02:22
  • @GaryKephart OK, but [Wildfly 13 supports from any JDK ... version from 8 to 10](https://stackoverflow.com/a/62002163/2985643). Perhaps I'm misunderstanding the situation, but how would upgrading your remote host to Wildfly 13 solve anything in that case? I see why you don't want to stay on WildFly 10, but won't you still get that `ClassNotFoundException` in your question if you move to Wildfly 13 but stay on Java 8? (Unfortunately the WildFly link to the WildFly 10 Release Notes gives a 404.) – skomisa Mar 17 '23 at 03:14
  • @GaryKephart I found some [formal documentation for WildFly 13](https://docs.wildfly.org/13/Getting_Started_Guide.html) which states it runs on "Java SE 8 or later". But if you stay on Java 8 on your remote host, how does upgrading WildFly from 10 to 13 solve anything, even if it works fine? – skomisa Mar 17 '23 at 03:27
  • I'm only getting that exception when I change the JVM from 8 to 11 with Wildfly 10. My full statement would be that I'm leaning towards upgrading my remote host to Wildfly 13 with Java 11. If Wildfly supports Java 8,9,10 and the exception is because of changes in Java 9, then maybe the combo of Wildfly 13 plus Java 11 will be ok. – Gary Kephart Mar 17 '23 at 06:29
  • @GaryKephart OK. But Wildfly 13 was released on May 31, 2018 and Java 11 was released on September 25, four months later, so there's no way that Wildfly 13 supports Java 11. You mentioned Wildfly 15 in your question - that would seem to be a better and safer alternative since it explicitly supports Java 8 and Java 11, with no downside. Best of luck. – skomisa Mar 17 '23 at 07:19
  • Like I said, though, I don't see Wildfly 15 as an available option on my remote hosting site, only Wildfly 13. I'll have to ask my hosting company if it's available but just not listed. I only have Wildfly 15 on my own machine. Thanks for your help. – Gary Kephart Mar 17 '23 at 18:05
  • @GaryKephart OK, understood. The answers to this SO question may be of interest: [Is it possible to run Wildfly 10 on new jdk17](https://stackoverflow.com/q/70129530/2985643). It seems that you can through scripting changes, though this approach would obviously not be supported if you hit problems. Depending on your situation, maybe this is a possible workaround on Java 11 as well? – skomisa Mar 17 '23 at 18:25
  • Final note: I went ahead and was able to upgrade to Wildfly 15. That seems to work. – Gary Kephart Apr 04 '23 at 15:01