I'm trying to run a Java application and I get the following error message. The application itself loads correctly, it just appears to be certain parts of it that fail.
Nov 13, 2012 2:43:53 PM org.jdesktop.application.Task failed
SEVERE: My.Application$9#7c4f8358 failed: java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser
java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser
at jpl.mipl.jade.jadis.agile2d.swing.JOGLPluggableRenderer.notifyBeforeSetRootPane(JOGLPluggableRenderer.java:105)
at jpl.mipl.jade.jadis.StereoJFrame.setRootPane(StereoJFrame.java:264)
at javax.swing.JFrame.frameInit(JFrame.java:236)
at javax.swing.JFrame.<init>(JFrame.java:159)
at jpl.mipl.jade.jadis.StereoJFrame.<init>(StereoJFrame.java:172)
at StereoWS.DSStereoFrame.<init>(DSStereoFrame.java:70)
at StereoWS.StereoWSView$9.doInBackground(StereoWSView.java:1067)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLCapabilitiesChooser
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 14 more
I'm running OS X 10.8 fully updated, I've installed JDK 7 and, in frustration, Apple's Java development tools. The program relies on a number of external libraries, but these are supplied with the jar and I trust that the program does actually look for them in the distribution directory when it runs (the errors aren't due to those packages though, I believe). As far as I can tell everything that I need to run the application is either already installed or somewhere where the jar can find it
I don't know if there's anything else I need to do to set up the environment that I haven't done yet, so if anyone can suggest something, I'm all ears! I will provide any extra information needed, but I don't know what would help - I'm not a Java guru by any means.
I believe you are using Java3D jars from the old Oracle site in combination with the latest JogAmp JOGLv2, this will not work of two reasons A) the jogl.jar is now renamed jogl-all.jar B) internal namespace changes, all com.sun.* classes is now found under com.jogamp.* and this will confuse the old Java3D code that expects the com.sun.* namespace.
Both JOGL and Java3D is now maintained by members of the JogAmp community:
Background of the move: http://labb.zafena.se/?p=656
The only supported way to use Java3D today is by using the community maintained Java3D in combination with the latest JogAmp JOGL v2.
Tutorial on how to setup the latest community maintained Java3D in combination with JOGLv2.
Julien Gouesse: Java 3D est de retour [Java 3D is back]
http://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/
Related
I have a Java desktop application that was running fine in Java 1.8; I'm upgrading to Java 1.11 for a client, and am getting the above error.
Full stacktrace:
java.lang.ExceptionInInitializerError
at net.sourceforge.tess4j.Tesseract.init(Tesseract.java:442)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:326)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:309)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:290)
at net.sourceforge.tess4j.Tesseract.doOCR(Tesseract.java:274)
at drivingrecordtool.file.DrivingRecordPDFTextReader.getOCRText(DrivingRecordPDFTextReader.java:152)
at drivingrecordtool.file.DrivingRecordPDFTextReader.getText(DrivingRecordPDFTextReader.java:46)
at drivingrecordtool.file.DrivingRecordFileReader.doInBackground(DrivingRecordFileReader.java:78)
at drivingrecordtool.file.DrivingRecordFileReader.doInBackground(DrivingRecordFileReader.java:1)
at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: zip file closed
at java.base/java.util.zip.ZipFile.ensureOpen(ZipFile.java:913)
at java.base/java.util.zip.ZipFile.getEntry(ZipFile.java:348)
at java.base/java.util.zip.ZipFile$1.getEntry(ZipFile.java:1130)
at java.base/java.util.jar.JarFile.getEntry0(JarFile.java:586)
at java.base/java.util.jar.JarFile.getEntry(JarFile.java:516)
at java.base/sun.net.www.protocol.jar.URLJarFile.getEntry(URLJarFile.java:131)
at java.base/java.util.jar.JarFile.getJarEntry(JarFile.java:478)
at java.base/jdk.internal.loader.URLClassPath$JarLoader.getResource(URLClassPath.java:945)
at java.base/jdk.internal.loader.URLClassPath.getResource(URLClassPath.java:315)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:455)
at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at net.sourceforge.tess4j.util.LoadLibs.getTessAPIInstance(LoadLibs.java:83)
at net.sourceforge.tess4j.TessAPI.<clinit>(TessAPI.java:42)
... 15 more
The Tesseract library has a Java wrapper that I've used for months successfully but now seems involved in the error, whatever it is. I've been using the same DLL and started getting this failure, and I've updated the Tesseraact DLL and the wrapper to their latest version.
More puzzling is that the application runs fine within eclipse, and only fails like this when run from a command line (Windows 10). I have uninstalled and reinstalled the DLL a couple of times, rebooted the machine each time, and am running out of things to try. I went through the entire Maven dependencies list and deleted all files found there from my repository, then refreshed the eclipse project to reload all the files in the list.
I saw one suggestion of placing a breakpoint in ZipFile, but that won't help since the problem does not appear in eclipse.
I'm willing to upgrade the Java further, but it would be nice, first, to have some knowledge of what the problem is so that I have some confidence that will fix it.
Can someone suggest what might be wrong, or strategies to find out?
I have an application running in Tomcat 9.0.45 with JDK 11 (OpenJDK 11.0.11).
After upgrading some libraries (Spring 4.3.30 to 5.3.9) using maven, the application throws the following Exception:
java.lang.NoClassDefFoundError: java/lang/constant/Constable
at my.app.SomeClass.process(SomeClass.java:123) ~[classes/:?]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) [spring-context-5.3.9.jar:5.3.9]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.base/java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.ClassNotFoundException: java.lang.constant.Constable
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1364) ~[catalina.jar:9.0.45]
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1187) ~[catalina.jar:9.0.45]
... 11 more
Obviously, it tries to run JRE 12 code in a JRE 11 environment.
As the Exception does not occur prior to updating the libraries, I guess some dependency got into the project that uses the JRE 12 code.
How can I find out which library/dependency causes the problem?
WebappClassLoaderBase debug log does not give any new information:
org.apache.catalina.loader.WebappClassLoaderBase.loadClass loadClass(java.lang.constant.Constable, false)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass Searching local repositories
org.apache.catalina.loader.WebappClassLoaderBase.findClass findClass(java.lang.constant.Constable)
org.apache.catalina.loader.WebappClassLoaderBase.findClass --> Returning ClassNotFoundException
Strangely, the Exception does not occur on my dev machine, so I also can't debug.
Any ideas are very much appreciated.
Edit: compiling with maven 3.8.1 using aspectj-maven-plugin 1.12.6.
The Constable interface (javadoc) was only added in Java 12.
So, your theory that the exception / stacktrace is caused by trying to run Java 12+ code on Java 11 is correct.
It is not entirely clear why this has happened. While the most recent versions of Spring are compatible with Java 16 ... they should also run on Java 11 (and indeed Java 8). It is possible that the Spring team have messed up and shipped some JARs that have been built incorrectly. But I doubt it.
I suspect that you have made a mistake in building your code. Maybe you compiled with a Java 12+ tool chain, against the Java SE 12+ runtime using a target version of Java 11?
#Stephen C pointed to the right direction - something has compiled something that way.
Turns out the machine that compiles the code, did not have Java 11 installed, but Java 16. (Still, that compiled perfectly runnable Java 11 code for Spring 4.3.30.)
I have removed Java 16 from the machine and installed Java 11 only. The code now runs without throwing the ClassNotFoundException.
As of why that happened, I still have no idea.
With InterClient 7.5.1 and 8.1.5, the creation of a new JDBC connection in Java 8 fails with
java.lang.NoClassDefFoundError: sun/io/ByteToCharConverter
This class seems to be referenced or used by the InterClient JDBC library.
The error does not occur with Java 7. Is there a way to work around this error?
This code reproduces the problem on Java 8:
package com.example.so25365952;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
public class Main {
interbase.interclient.Connection conn;
public static void main(String[] args) {
try {
Class.forName("interbase.interclient.Driver");
DriverManager.getConnection("jdbc:interbase://localhost/data/mydb.gdb", "sysdba", "password123");
} catch (ClassNotFoundException | SQLException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
Output:
Exception in thread "main" java.lang.NoClassDefFoundError:
sun/io/ByteToCharConverter at
interbase.interclient.Connection.connect(Unknown Source) at
interbase.interclient.Connection.(Unknown Source) at
interbase.interclient.Driver.connect(Unknown Source) at
java.sql.DriverManager.getConnection(DriverManager.java:664) at
java.sql.DriverManager.getConnection(DriverManager.java:247) at
com.example.so25365952.Main.main(Main.java:14) Caused by:
java.lang.ClassNotFoundException: sun.io.ByteToCharConverter at
java.net.URLClassLoader$1.run(URLClassLoader.java:372) at
java.net.URLClassLoader$1.run(URLClassLoader.java:361) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:360) at
java.lang.ClassLoader.loadClass(ClassLoader.java:424) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at
java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 6 more
Use db2jcc4.jar which is latest version. If you changed your mind to use Java 8 you need to use this.
I have the similiar problem and this change help me to fix the error.
The sun.* and sunw.* packages are internal and should not be used for exactly this reason. Seems like someone at InterClient screwed up. I'd advise you to contact them with a bug report, so they'll know to fix this for future releases.
If you can't wait for a future release, and are willing to break some licences (which I don't recommend of course). You may be able to create your own sun.io.ByteToCharConverter by copying the code from here, and adding it to the bootstrap classpath with -Xbootclasspath, but that would be a last resort.
sun.io.ByteToCharConvertor was deprecated in java 7. and it seems they remove it in java 8.
The answer to the question interbase.interclient.UnlicensedComponentException with the latest interclient.jar IB (v7.5.80) seems to work for me too. It suggests to use version 1.5 of the JDBC driver for Firebird. Fortunately this driver does not rely on deprecated sun classes and works with JRE 8.
I agree with Sergio, this is now an even older question! :-) But at my workplace, too, we are unfortunately as of 2018 for various reasons still using a super-old Interbase (v9, 2009). So at some point I too was unable to continue using the interclient.jar packaged with IBv9, because I would receive this same sun.io.ByteToCharConverter error. No doubt this was because the Java on my client machine was so much newer now. After all, it is 9 years later. But I did not want in my case to go with the solution of installing a legacy Java on my machine, as has worked for others.
So as a solution, on my client machine (Linux/Debian x64), I installed Interbase 2017, the latest at the time(*). But when installing, I only installed the IB Client (not Server + Client). The /opt/interbase/lib/interclient.jar that is packaged with the IB 2017 client works just fine now (no sun.io error). And yes, this IB 2017 (v13) interclient.jar works just fine connecting to our old IB 2009 server.
(I have to hand it to Embarcadero: They are still 'supporting' being able to connect to older versions -- at least in their interclient.jar and libgds.so. This makes sense as useful of course for those sysadmins who want to migrate from older systems to newer ones.)
(*) You can get a free trial version of Interbase from embarcadero. As far as I can tell, though, when you install it, if you install the Client only and use the interclient.jar, this does not require a license. Only installing the IB server (and depending on number of users/connections, etc) but that is nothing new to IB users/admins.
Works for us, at least, until we upgrade our server's IB version, or move to Firebird.
Hope this helps at least one other person out there.
This is an old question, but in case this helps someone:
Find the Java 7 rt.jar in the lib folder.
Open the file, and go to the folder sun/io.
Find the Java 8 rt.jar in the lib folder.
Open the file, and go to the folder sun/io.
Move all the .class files in the folder sun/io from the Java 7 to the Java 8 sun/io folder, except for Win32ErrorMode.class (this class was in both jar files).
Save the Java 8 rt.jar with the added classes.
This worked for me, using an old jdbc driver for SQL Server.
use
<!-- https://mvnrepository.com/artifact/com.ibm.db2.jcc/db2jcc -->
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc</artifactId>
<version>db2jcc4</version>
</dependency>
replace
<dependency>
<groupId>com.ibm.db2.jcc</groupId>
<artifactId>db2jcc</artifactId>
<version>10.1</version>
</dependency>
can Solve the problem
Trying to launch a java FX application on a Linux system using X. I get the following stack trace. After a bunch of googling and installing various packages, I am at a loss. Any thoughts?
java -jar tacoma_testing.jar
Prism-ES2 Error : GL_VERSION (major.minor) = 1.4
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.javafx.main.Main.launchApp(Main.java:698)
at com.javafx.main.Main.main(Main.java:871)
Caused by: java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: /projects/tacoma/tacoma_regression_testing/jdk1.7.0_25/jre/lib/amd64/libglass.so: libgio-2.0.so.0: cannot open shared object file: No such file or directory
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:281)
at com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:124)
at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:163)
at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:47)
at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:115)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.UnsatisfiedLinkError: /projects/tacoma/tacoma_regression_testing/jdk1.7.0_25/jre/lib/amd64/libglass.so: libgio-2.0.so.0: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1957)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1882)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1843)
at java.lang.Runtime.load0(Runtime.java:795)
at java.lang.System.load(System.java:1061)
at com.sun.glass.utils.NativeLibLoader.loadLibraryFullPath(NativeLibLoader.java:200)
at com.sun.glass.utils.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:88)
at com.sun.glass.utils.NativeLibLoader.loadLibrary(NativeLibLoader.java:31)
at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:73)
at com.sun.glass.ui.Application.loadNativeLibrary(Application.java:80)
at com.sun.glass.ui.gtk.GtkPlatformFactory$1.run(GtkPlatformFactory.java:28)
at com.sun.glass.ui.gtk.GtkPlatformFactory$1.run(GtkPlatformFactory.java:25)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.glass.ui.gtk.GtkPlatformFactory.<clinit>(GtkPlatformFactory.java:25)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:20)
at com.sun.glass.ui.Application.Run(Application.java:103)
at com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:271)
... 5 more
Redhat is not listed as as supported configuration for JavaFX 2.2.
Nor is running JavaFX in a headless mode.
This may change for Java 8, but Java 8 has not been released yet, so the list of supported configurations for JavaFX running on Java 8 has not been published.
Currently the supported configuration set for Linux is only => Ubuntu 10.4+ gtk2 2.18+ with optional additional requirements for av codecs if you also want media playback support.
So try using a supported Ubuntu system instead of Redhat and you may or may not get that working in a headless environment.
I tested and it works fine with Redhat 6. Redhat 5 seems to be the problem.
Redhat Enterprise Linux 6 support will be added for Java 8 (to be released in the next few weeks).
A RHEL 5.5 support request was closed as won't fix, see RT-22564 "JavaFX Support for Red Hat Enterprise Linux 5.5".
If you can find a way to install gtk2 2.18+ on RHEL 5 you may be able to get it to work, though no promises.
I'm trying to develop a java3d application, i try everything, i just download the jogamp-platform because how i could read in many websites the java3d is obsolete and for mac os x you need this, i put them all in /System/Frameworks/Java/Extensions where are my .jar files in order to not add to the classpath in Eclipse but it still getting the same error:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/AbstractGraphicsDevice
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:171)
at javax.media.j3d.Pipeline$1.run(Pipeline.java:143)
at java.security.AccessController.doPrivileged(Native Method)
at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:138)
at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:926)
at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:280)
at javax.media.j3d.Canvas3D.<clinit>(Canvas3D.java:3862)
at Apartado_a.<init>(Apartado_a.java:17)
at Apartado_a.main(Apartado_a.java:67)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.AbstractGraphicsDevice
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
... 10 more
These are the files inside extensions folder:
j3daudio.jar
j3dcore.jar
j3dutils.jar
joal-natives-macosx-universal.jar
jogl-all.jar
gluegen-rt.jar
gluegen-rt-natives-macosx-universal.jar
Regards!
Mac OS X comes pre-installed with Java 3D version 1.3. You can find these files in /System/Library/Java/Extensions. If you need to install Java 3D version 1.5 (and it sounds like you do), then you can use this installer: http://create.ife.no/vr/tools/j3d/java3d_1_5_2-macosx.pkg.zip
Don't use the /System/Frameworks/Java/Extensions folder for this.
Instead, include the relevant libraries in the lib/ folder of your application. Also, check which version of the JDK you are using. I believe there are some issues with Java3D running on the newer Apple-provided JVMs versus the older Oracle/Sun provided ones.