Page 1 of 1

JNLPClassLoader cannot find class: ClassNotFoundException

Posted: 24 Jun 2022, 11:01
by marek
We experience some strange behavior when running a graphical application using, which is started using OpenWebStart 1.6.0 running on Oracle Java 17.0.1 on Windows 10. The application is correctly downloaded to the client from the server as defined in the JNLP and after the start the following two ClassNotFoundExceptions the being thrown:

Code: Select all

java.lang.NoClassDefFoundError: javax/media/jai/JAI
                at com.luciad.format.raster.TLcdGeoTIFFModelDecoder.<clinit>(LuciadLightspeed_2020.1.19:328)
                at com.luciad.lucy.addons.decoders.aD.a(LuciadLightspeed_2020.1.19:42)
                at com.luciad.internal.lucy.format.TLcyLazyModelDecoderWrapperFactory$TLcyLazyModelDecoder.a(LuciadLightspeed_2020.1.19:109)
                at com.luciad.internal.lucy.format.TLcyLazyModelDecoderWrapperFactory$TLcyLazyModelDecoder.b(LuciadLightspeed_2020.1.19:101)
                at java.base/java.lang.Iterable.forEach(Iterable.java:75)
                at com.luciad.internal.lucy.format.c.run(LuciadLightspeed_2020.1.19:193)
                at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: javax.media.jai.JAI
                at net.sourceforge.jnlp.runtime.classloader.JNLPClassLoader.lambda$loadClass$9(JNLPClassLoader.java:1446)
                at java.base/java.util.Optional.orElseThrow(Optional.java:403)
                at net.sourceforge.jnlp.runtime.classloader.JNLPClassLoader.loadClass(JNLPClassLoader.java:1446)
                at com.luciad.format.raster.TLcdGeoTIFFModelDecoder.<clinit>(LuciadLightspeed_2020.1.19:328)
                at com.luciad.lucy.addons.decoders.aD.a(LuciadLightspeed_2020.1.19:42)
                at com.luciad.internal.lucy.format.TLcyLazyModelDecoderWrapperFactory$TLcyLazyModelDecoder.a(LuciadLightspeed_2020.1.19:109)
                at com.luciad.internal.lucy.format.TLcyLazyModelDecoderWrapperFactory$TLcyLazyModelDecoder.b(LuciadLightspeed_2020.1.19:101)
                at java.base/java.lang.Iterable.forEach(Iterable.java:75)
                at com.luciad.internal.lucy.format.c.run(LuciadLightspeed_2020.1.19:193)
                at java.base/java.lang.Thread.run(Thread.java:833)
 

Code: Select all

java.lang.NoClassDefFoundError: com/sun/media/imageioimpl/plugins/tiff/TIFFImageMetadata
                at com.luciad.lucy.addons.decoders.aD.a(LuciadLightspeed_2020.1.19:86)
                at com.luciad.internal.lucy.format.TLcyLazyModelEncoderWrapperFactory$TLcyLazyModelEncoder.b(LuciadLightspeed_2020.1.19:102)
                at com.luciad.internal.lucy.format.TLcyLazyModelEncoderWrapperFactory$TLcyLazyModelEncoder.a(LuciadLightspeed_2020.1.19:94)
                at java.base/java.lang.Iterable.forEach(Iterable.java:75)
                at com.luciad.internal.lucy.format.f.run(LuciadLightspeed_2020.1.19:186)
                at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.ClassNotFoundException: com.sun.media.imageioimpl.plugins.tiff.TIFFImageMetadata
                at net.sourceforge.jnlp.runtime.classloader.JNLPClassLoader.lambda$loadClass$9(JNLPClassLoader.java:1446)
                at java.base/java.util.Optional.orElseThrow(Optional.java:403)
                at net.sourceforge.jnlp.runtime.classloader.JNLPClassLoader.loadClass(JNLPClassLoader.java:1446)
                at com.luciad.lucy.addons.decoders.aD.a(LuciadLightspeed_2020.1.19:86)
                at com.luciad.internal.lucy.format.TLcyLazyModelEncoderWrapperFactory$TLcyLazyModelEncoder.b(LuciadLightspeed_2020.1.19:102)
                at com.luciad.internal.lucy.format.TLcyLazyModelEncoderWrapperFactory$TLcyLazyModelEncoder.a(LuciadLightspeed_2020.1.19:94)
                at java.base/java.lang.Iterable.forEach(Iterable.java:75)
                at com.luciad.internal.lucy.format.f.run(LuciadLightspeed_2020.1.19:186)
                at java.base/java.lang.Thread.run(Thread.java:833)

We can see in the log (attached) that the corresponding libs containing the classes are correctly loaded and available:
1. jai_core-1.1.4+8-lcd.jar
2. jai_imageio-1.2+23-lcd.jar

Is there anything special about the JNLPClassLoader which could prohibit to load them?
Or any other idea on the root cause of this issue? Is there any workaround like a different classloader to fix this issue? It's of course no problem to start the application as standalone without OpenWebStart.

Re: JNLPClassLoader cannot find class: ClassNotFoundException

Posted: 27 Jun 2022, 10:56
by Janak Mulani

Code: Select all

java.lang.ClassNotFoundException: javax.media.jai.JAI
com.sun.media.imageioimpl.plugins.tiff.TIFFImageMetadata
Does your app run with Java 17 in standalone mode?

Please check if these classes are supported by Java 17? You will have to export modules or find alternative libs.

Re: JNLPClassLoader cannot find class: ClassNotFoundException

Posted: 27 Jun 2022, 15:50
by marek
Yes, as standalone application in Oracle Java 17.0.1 it works just fine, the problem occur only when starting with OpenWebStart, tried version 1.5.2 and 1.6.0. Both these libraries are provided in the web-application and you can see in the log that these libraries are also correctly loaded from classpath.

Re: JNLPClassLoader cannot find class: ClassNotFoundException

Posted: 28 Jun 2022, 14:52
by Janak Mulani
Can you provide us with a sample to reproduce the issue?

Can you try running with https://github.com/karakun/OpenWebStar ... 0.0-alpha2 and let us know if it worked?

Re: JNLPClassLoader cannot find class: ClassNotFoundException

Posted: 28 Jun 2022, 18:39
by marek
It works with the version 3.0.0-alpha2, but only when the console is visible, otherwise it is failing, screenshot attached.

Re: JNLPClassLoader cannot find class: ClassNotFoundException

Posted: 29 Jun 2022, 09:14
by Janak Mulani
Can you please send the logs of the time it runs and fails with OWS 3.0.0?

Will it be possible for you to provide a small example or allow us to run your Jnlp from our machine?