RAP 3.7 and Java 11 Support [message #1801734] |
Fri, 25 January 2019 11:46  |
|
Trying to run a RAP 3.7 application WAR inside FireFly 15.0.1 with various versions of Java on Windows 7 64-bit, and running into problems with any Java version beyond JDK8 (Oracle or an OpenJDK build).
What versions of Java should I expect a RAP 3.7 application to work with?
JDK8 64-bit: OK
AdoptOpenJDK8 64-bit: OK
OpenJDK9 64-bit: ERROR
JDK11 64-bit: ERROR
I've tried various other versions too, and the common factor seems to be moving beyond JDK8.
The issue I see is in resource handling and ClassLoader usage, with the pertinent part of the exception being:
2019-01-25 15:33:07,028 ERROR [io.undertow.request] (default task-2) UT005023: Exception handling request to /<myapp>/<mycontext>: java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
This is in calling:
URLClassLoader pcl = (URLClassLoader)ClassLoader.getSystemClassLoader();
Is this a RAP-support issue, or something I can workaround in my code by changing the way I deal with the ClassLoader? The only difference is changing from Java8 to something newer?
I want to continue to compile my code using Java8.
Thanks, John
---
Just because you can doesn't mean you should
|
|
|
|
Re: RAP 3.7 and Java 11 Support [message #1801745 is a reply to message #1801735] |
Fri, 25 January 2019 15:04   |
|
Hi Ivan,
No, sorry, this is our own code calling getSystemClassLoader() and casting to URLClassLoader, not RAP.
I wonder if this is no longer supported in Java9+ or if there is a 'new' way of doing it? I haven't investigated too far yet, as I just assumed that versions of Java would be backwards-compatible, but if you have any other experiences, that would be useful?
Thanks, John
---
Just because you can doesn't mean you should
|
|
|
Re: RAP 3.7 and Java 11 Support [message #1802109 is a reply to message #1801745] |
Fri, 01 February 2019 09:41   |
Linuxhippy Mising name Messages: 71 Registered: July 2009 |
Member |
|
|
John Gymer wrote on Fri, 25 January 2019 10:04Hi Ivan,
No, sorry, this is our own code calling getSystemClassLoader() and casting to URLClassLoader, not RAP.
I wonder if this is no longer supported in Java9+ or if there is a 'new' way of doing it? I haven't investigated too far yet, as I just assumed that versions of Java would be backwards-compatible, but if you have any other experiences, that would be useful?
Thanks, John
For Java9' module system the class loader structure and architecture has been re-designed. Casting the system class loader to URLClassLoader was using an undocumented implementation detail, so breakage was to be expected.
|
|
|
Re: RAP 3.7 and Java 11 Support [message #1802260 is a reply to message #1802109] |
Tue, 05 February 2019 13:56   |
|
Thanks Ivan.
I've re-written our Class Loader logic completely, as there is no direct work-around, so all is good now thanks, one of the keys being to use "Class.forName()" instead.
Cheers, John
---
Just because you can doesn't mean you should
|
|
|
|
Powered by
FUDForum. Page generated in 0.02502 seconds