JavaFX 11 Error intializing QuantumRenderer when running custom JRE image on Windows - windows

I have built my app with JavaFX 11 and now I need to distribute it. I have chosen to distribute it in two ways: cross-platform fat-jar (I know, I know, it is discouraged, but that is not the point) and platform specific image created with jlink.
I am building on Linux Mint 20.1. I am using Maven and creating runtime image with javafx-maven-plugin. I have JDKs for both platforms on my Linux machine and pointed to the corresponding jmods folder in pom.xml.
The built fat-jar works on both Linux and Windows where both have installed the latest Java SDK (11.0.12).
The image for Linux also works without problems.
However, the image for Windows does not run and the output of -Dprism.verbose=true is this:
B:\Data\sjsm\releases\1.0\sjsm-1.0-win\bin>sjsm-1.0-launcher.bat Prism pipeline init order: d3d sw
Using Double Precision Marlin Rasterizer
Using dirty region optimizations
Not using texture mask for primitives
Not forcing power of 2 sizes for textures
Using hardware CLAMP_TO_ZERO mode
Opting in for HiDPI pixel scaling
Prism pipeline name = com.sun.prism.d3d.D3DPipeline
GraphicsPipeline.createPipeline failed for com.sun.prism.d3d.D3DPipeline
java.lang.ClassNotFoundException: com.sun.prism.d3d.D3DPipeline
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(Unknown Source)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(Unknown Source)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
*** Fallback to Prism SW pipeline
Prism pipeline name = com.sun.prism.sw.SWPipeline
GraphicsPipeline.createPipeline failed for com.sun.prism.sw.SWPipeline
java.lang.UnsatisfiedLinkError: no prism_sw in java.library.path: [B:\Data\sjsm\releases\1.0\sjsm-1.0-win\bin, C:\WINDOWS\Sun\Java\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\Program Files\Eclipse Foundation\jdk-11.0.12.7-hotspot\bin, C:\WINDOWS\system32, C:\WINDOWS, C:\WINDOWS\System32\Wbem, C:\WINDOWS\System32\WindowsPowerShell\v1.0\, C:\WINDOWS\System32\OpenSSH\, C:\Program Files\dotnet\, B:\xampp\php, B:\MinGW\bin, C:\Program Files\Microsoft SQL Server\120\Tools\Binn\, B:\Git\cmd, B:\Matlab R2020a\bin, B:\Microsoft VS Code\bin, C:\Users\User\AppData\Local\Microsoft\WindowsApps, B:\xampp\php, ., .]
at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.base/java.lang.Runtime.loadLibrary0(Unknown Source)
at java.base/java.lang.System.loadLibrary(Unknown Source)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(Unknown Source)
at javafx.graphics/com.sun.glass.utils.NativeLibLoader.loadLibrary(Unknown Source)
at javafx.graphics/com.sun.prism.sw.SWPipeline.lambda$static$0(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.prism.sw.SWPipeline.<clinit>(Unknown Source)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
at javafx.graphics/com.sun.prism.GraphicsPipeline.createPipeline(Unknown Source)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(Unknown Source)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Graphics Device initialization failed for : d3d, sw
Error initializing QuantumRenderer: no suitable pipeline found
java.lang.RuntimeException: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer.getInstance(Unknown Source)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.init(Unknown Source)
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: Error initializing QuantumRenderer: no suitable pipeline found
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.init(Unknown Source)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(Unknown Source)
... 1 more
Exception in thread "main" java.lang.RuntimeException: No toolkit found
at javafx.graphics/com.sun.javafx.tk.Toolkit.getToolkit(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.startup(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.startToolkit(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
I got the same response when I tried to run the project from source on Windows. (I copied the project to Windows, installed maven, and it would not even run with javafx:run, let alone jlink with javafx:jlink)
I have tried many links on Google and none of them works, People either have something missing in their installation (I have everything installed at least as far as I have found) or the issue pops up in a different situation (when packaging a fat-jar for example, or running their application from IDE).
What I have not tried so far is creating the image by hand from command line, since I have read many times that it is discourage compared to using a build tool like Maven.
What can I try next?

java.lang.UnsatisfiedLinkError: no prism_sw in java.library.path
Means you're definitely missing some dlls from your library path, although this could only be a part of the problem.
When you download javafx sdk for windows from this link, you get a zip with the following structure:
The bin folder contains all the natives you need to run JavaFx (on windows, or the platform you downloaded the sdk for)
Note that you don't always need all the natives, jfxwebkit.dll for example is only needed when you work with javafx-web.
You need to extract them somewhere and add the folder you extracted them in to the library path when you run the java program
java "-Djava.library.path=path_to_natives" -classpath "your_classpath" <Your main class>

I have managed to solve this. The javafx-maven-plugin expects in <jModsPath> a colon separated list of paths to ALL jmods, not just the standard oridinary JDK. It pulls what's missing out of maven repository I think but ignores all platform clasifiers.

Related

Java3D: JNI Error - java.lang.NoClassDefFoundError: javax/media/j3d/Canva s3D: Windows 7

OS: Windows 7 64-bit
Java: C:\Program Files\Java\jdk1.8.0_202 [Installed jdk-8u202-windows-x64.exe]
Java 3d: C:\Program Files\Java\Java3D\1.5.1 [Installed java3d-1_5_1-windows-amd64.exe]
Environment Varaibles:
JAVA_HOME C:\Program Files\Java\jdk1.8.0_202
JRE_HOME C:\Program Files\Java\jdk1.8.0_202\jre
PATH=%PATH%:C:\Program Files\Java\jdk1.8.0_202\bin;C:\Program Files\Java\Java3D\1.5.1\bin;C:\Program Files\Java\Java3D\1.5.1\lib;
And also copied j3d jars[j3dcore.jar, j3dutils.jar and vecmath.jar] to C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext. j3dcore-ogl.dll to C:\Program Files\Java\jdk1.8.0_202\bin
Running the classic HelloJava3D Program and getting the below error. I can understand this is looking for Canvas3d class but that already present in one of the java3d jar file. Have come across similar thread in stackoverflow where they mentioned to check the classpath.Above i've shared the path which i set. Anything i missed out?
Java3D - Some classes not found but classpath is set correctly
But in my case its showing some JNI error is it because some architecture mismatch?
D:\JavaSample>java HelloJava3D
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/j3d/Canva
s3D
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javax.media.j3d.Canvas3D
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
One of the tool in my project is dependent on Java3d and i'm from c++ background and new to this project. I couldn't figure out what i am missing. Please suggest.

spring starter rest class not found hibernateexception

I downloaded the latest released Spring Toolkit - 3.8.1 Release.
I installed the starter "Import Spring Getting Started Content" -> "Accessing Data Rest"
I then tried to run "Complete" in a tomcat server and separately as a java application. In both cases it crashed. Most of the stack trace is omitted below:
Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_73]
... 65 common frames omitted
Is there any fix?
Also, there is no Hello controller and the web site (https://spring.io/guides/gs/accessing-data-rest/) does not refer to creating such a thing.
Is it just completely broken?
I haven't discovered the ultimate cause, but I have solved the problem.
The computer where this wasn't working had had older versions of eclipse installed in the past, e.g. gallileo. The .eclipse directory dated from April 2013.
Completely removing the .eclipse and reinstalling STS caused STS to work fine. It is also important to install eclipse/STS outside of Windows protected directories like "Program Files" since we don't want to run eclipse as an administrator and Eclipse likes to write files in its installation directory.

UnsatisfiedLinkError with Oracle OTT utility

I am trying to run Oracle's Object Type Translator Utility (OTT) and getting below error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\oraclexe\app\oracle\product\11.2.0\server\bin\ocijdbc11.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at oracle.jdbc.driver.T2CConnection$1.run(T2CConnection.java:3516)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.jdbc.driver.T2CConnection.loadNativeLibrary(T2CConnection.java:3512)
at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:266)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:162)
at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:53)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at oracle.ott.Konnection.getTheConnection(Konnection.java:102)
at oracle.ott.Konnection.<init>(Konnection.java:39)
at oracle.ott.Doit.main(Doit.java:107)
at oracle.ott.c.CMain.main(CMain.java:9)
It was working fine few months ago and no idea why this is giving error now.
So, I figured out finally that there was some issue with the old setup of instant client 11_2.0, so i installed new instant client 11_2.2 and set all the required environment variables and it works perfectly fine.

CORBA/Webstart application doesn't work with Java7u55 anymore

My CORBA/Webstart application using an alternative ORB implementation (OpenORB) doesn't work with Java7u55 anymore.
The following exception occurs:
Error org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation org.openorb.CORBA.ORBSingleton vmcid: 0x0 minor code: 0 completed: No
org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation org.openorb.CORBA.ORBSingleton vmcid: 0x0 minor code: 0 completed: No
at org.omg.CORBA.ORB.create_impl_with_systemclassloader(Unknown Source)
at org.omg.CORBA.ORB.init(Unknown Source)
at org.openorb.CORBA.kernel.OpenORBLoader.init(Unknown Source)
at org.openorb.CORBA.ORB.set_parameters(Unknown Source)
at org.omg.CORBA.ORB.init(Unknown Source)
...
Caused by: java.lang.ClassNotFoundException: org.openorb.CORBA.ORBSingleton
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
... 17 more
I think a a change in orb.omg.CORBA.ORB.init() is the reason the class for the ORB implementation wasn't found anymore as SystemClassLoader is used here now to create the ORB instance instead of current Thread's ContextClassLoader as before.
As a workaround I've copied the Jar containing org.omg.CORBA API of the ORB implementation I'm using to <jre-home>/lib/endorsed/ expecting that it will be used instead but still the implementation in rt.jar is used.
Any ideas how to work around this problem?
Finally I found a workaround which doesn't work for the currently used OpenORB but for JacORB (3.4).
Oracle obviously updated the release notes suggesting to configure only the org.omg.CORBA.ORBClass property but to ommit org.omg.CORBA.ORBSingletonClass which means the default singleton implementation shipped with Java will be used which is visible for the SystemClassLoader.
This may not work with all ORBs and in fact it doesn't work with OpenORB as it checks org.omg.CORBA.ORBSingletonClass but my application works without problems with the mentioned version of JacORB now.
there should be several workarounds:
specify the following VM args when launching your app: -Djava.endorsed.dirs=/path/to/your/corba_library_jars_folder
specify the following VM args when launching your app:
-Xbootclasspath/p:/path/to/your/corba_lib.jar:/path/to/your/corba_lib2.jar:...
copy your jars into $JAVA_HOME/jre/lib/endorsed directory (create it if it doesn't exist)

Tomcat 7 : Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file

I have installed tomcat7 in my windows xp pc and on starting the service, i cannot access localhost:8080 in my browser and found the following in tomcat7 log files.
2013-05-15 15:00:30 Commons Daemon procrun stderr initialized
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number
in class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Tomcat 7 requires a minimum of Java 6. The most likely cause is that you are trying to run Tomcat on Java 5 or earlier.
The alternative is that you have added something to your Tomcat install that has been compiled with a later version of Java that you are running. In this case, get a clean Tomcat install running first and then deal with the class version problem (either by running Tomcat with a later version of Java or by recompiling whatever it is you have added for Java 6 or earlier).

Resources