Running jzy3d demos result in ClassNotFoundException - java

The problem is as follows, during startup of the jzy3d demo ScatterDemo.java :
Exception in thread "main" java.lang.NoClassDefFoundError: javax/media/opengl/GLProfile
at org.jzy3d.chart.Settings.<init>(Settings.java:19)
at org.jzy3d.chart.Settings.getInstance(Settings.java:48)
at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:18)
at org.jzy3d.analysis.AnalysisLauncher.open(AnalysisLauncher.java:13)
at org.jzy3d.demos.scatter.ScatterDemo.main(ScatterDemo.java:16)
Caused by: java.lang.ClassNotFoundException: javax.media.opengl.GLProfile
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
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)
... 5 more
Java Result: 1
Configuration is NetBeans 7.3.1, jzy3d-api-0.9.1, jzy3d-swt-0.9.1, log4j-1.2.17, gluegen-rt (latest stable), jogl-all (latest stable), JDK1.7
I am aware of the following change (Moving all of javax.media.opengl to com.jogamp.opengl, https://jogamp.org/bugzilla/show_bug.cgi?id=682). I have gone through the usual process of including .jar files into the project.
Project compiles fine, does not run.
My question(s) are: Can I somehow redirect javax.media.opengl.* to com.jogamp.opengl.* ? What is the correct way to resolve this problem?

As you can see here, even the code on the master branch (0.9.2) isn't based on the latest version of JOGL. Please ask Martin Pernollet to make the necessary changes (replace javax.media.* by com.jogamp.*) or do it yourself. You can rebuild Jzy3d to test it with the modifications of the import clauses. This is the correct way of solving this simple problem.

Related

MongoDB with java Exception in thread "main" java.lang.NoClassDefFoundError: org/bson/conversions/Bson

When I execute mycode from intelliJ Idea it works fine but when I run the jar on my server it throws the below error. I am using 'org.mongodb:mongodb-driver:3.4.1' version.
Exception in thread "main" java.lang.NoClassDefFoundError: org/bson/conversions/Bson
at com.myapp.server.mongo.MongoDbHandler.prepareMongoDb(MongoDbHandler.java:68)
at com.myapp.server.mongo.MongoDbHandler.<init>(MongoDbHandler.java:22)
at com.myapp.server.Client.main(Client.java:167)
Caused by: java.lang.ClassNotFoundException: org.bson.conversions.Bson
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)
... 3 more
I know its an old thread and its just for those who have the similar issues. Few days back I was also facing the same issue with same error trace while running the jar by command line.After rechecking the code found that
It was not a problem of the jar version but its problem of the packaging of the
jar
After packing the jar with all proper dependencies will solve this issue.
I have used
maven-assembly-plugin
for packaging and its works.
.
If I had to guess you need to get yourself whatever BSON library you're using; I wouldn't say that Mongo is your problem.
key line here is:
"Caused by: java.lang.ClassNotFoundException: org.bson.conversions.Bson"
So it's saying that it's not finding that particular class, I would look in IntelliJ and see what BSON library it is, then put it in your build directory (or java lib) on your server.

Classpath issue with Intellij Idea 2016.1.1 and Gradle

After a recent upgrade in Idea I now get a ClassNotFoundException in code that just a day ago was working perfectly.
If i run gradle in the command line it works perfectly, but if I run in Idea it fails with the ClassNotFoundException.
I've googled the problem and it seems that others have similar issues, but the solutions proposed for them don't seem to work for me.
I get that it's probably a classpath and/or gradle issue with the latest version of Idea, but I cannot see exactly what the issue would be since I've only recently moved over to both Idea and Gradle from Eclipse and Maven. My general Java experience is very good.
The full stack trace is as follows:
Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.NoClassDefFoundError: com/badlogic/gdx/physics/box2d/Shape
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:130)
Caused by: java.lang.NoClassDefFoundError: com/badlogic/gdx/physics/box2d/Shape
at uk.co.redfruit.gdx.skyisfalling.listeners.PlayButtonListener.changed(PlayButtonListener.java:18)
at com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.handle(ChangeListener.java:28)
at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:181)
at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:146)
at com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked(Button.java:123)
at com.badlogic.gdx.scenes.scene2d.ui.Button$1.clicked(Button.java:91)
at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:89)
at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:58)
at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:354)
at com.badlogic.gdx.backends.lwjgl.LwjglInput.processEvents(LwjglInput.java:316)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:210)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:123)
Caused by: java.lang.ClassNotFoundException: com.badlogic.gdx.physics.box2d.Shape
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 12 more

Raspberry pi - java - Serial Com

I've got a serious problem with my Raspberry Pi (OS: Raspbian) and Java (JDK-7-Armhf). My code wont execute without creating a Exception.
I'll been reading and trying several proposals and nothing have worked yet.
So now i am confused of what went wrong..?
So it goes like this:
I've got a Java source code that will run in my Eclipes IDE.
But when i export the .jar-file, even with library (JRE System lib. _86, JavaSE1.7, JAVAX.comm), as "Runnabel JAR" or just .JAR and execute it om my Raspberry pi, i've got "NoCLassDefFoundExecption: SerialPortEventListener..!
I just don't know why, it won't find the library and use it..!
On my Pi i have librxtx-java installed and JDK-7-oracle-armhf.
librxtx-java should be setting its JAVA_PATH on it's own when installed, but not sure that is done correct!
(I've got a folder /usr/jni and it contains: librxtxSerial.so and
/usr/lib/jvm/jdk-7-oracle-armhf/).
Looking at the library Javax.RXTXcomm in Eclipse, i've got RXTXcomm.jar, that contains SerialPortEventListener, so it is defininated i the .jar.
I'm thinking about, could it be, that there is a missing link between my Java JVM and linux serialport driver? My JRE is working in some way, because it will execute a code to readout HOSTNAME & IP-Adress.
So is there some one who knows how to fix this..?
This is a readout of Java Exception:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/comm/SerialPortEventListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
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)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Caused by: java.lang.ClassNotFoundException: javax.comm.SerialPortEventListener
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
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)
... 13 more
A copy of my code. "SimpleRead.java" The original from java comm API samples
You have to change the reference from javax.comm to gnu.io in your source code.
Try following:
Switch to root and run the program you created
If that helps do following
sudo adduser username dialout
then log out and log in from all terminals and GUIs

Java program that uses pptx4j throws org/apache/commons/lang/NotImplementedException

I'm using sample code from www.docx4java.org to run the program that will create a powerpoint slide so that i can learn the use of the docx4j library. But it gives me an exception even tough i have already added both commons-logging-1.2.jar and commons-logging-1.2-javadoc.jar to my classpaths library as (in which i also have apache-logging-log4j.jar, docx4j-3.2.1.jar, slf4j-nop-1.6.1 and slf4j-api-1.7.5.jar). This is the output:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/NotImplementedException
at org.docx4j.openpackaging.packages.PresentationMLPackage.createPackage(PresentationMLPackage.java:169)
at org.docx4j.openpackaging.packages.PresentationMLPackage.createPackage(PresentationMLPackage.java:146)
at org.docx4j.samples.CreateHelloWorld.main(CreateHelloWorld.java:30)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.NotImplementedException
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 3 more
Java Result: 1
BUILD SUCCESSFUL (total time: 0 seconds)
Is there an incompatibility betweent the jars i am using or am i missing more jar files to work with pptx4j?
Originally i added docx4j-3.2.1.jar and slf4j-api-1.7.5.jar to work with this sample code that creates a word file. But with the pptx4j i haven't found a solution, shouldn't it work since i already have apache-logging-log4j and commons-logging-1.2?
It's not throwing org/apache/commons/lang/NotImplementedException, it's saying it can't find it:
NoClassDefFoundError: org/apache/commons/lang/NotImplementedException
You need to add Apache Commons Lang v2.x (not v3, that uses a different package name to the one the error mentions) to your classpath.

Java communication with JavaDB classNotFoundException

I'm trying to make a Java program that can communicate with JavaDB. I've made the Database class, started a server and made a tiny client program to check if they would communicate.
The program crashes when i try to run it, giving a class not found exception at the line where i try to set the database driver. I googled it and found that this error appears if derbyclient.jar and derby.jar are not found in the classpath. I also read that the scripts setNetworkClientCP and setNetworkServerCP found in the db directory would set these in the classpath. I found the scripts, ran them, and checked to make sure the classpath got updated, but i still get the same error. Does anyone know what the problem might be?
EDIT: SOLVED - i just realized that i need to include the derbyclient.jar in the NetBeans project library.
I'm using NetBeans and the built in JavaDB. I set the classpath by using the scripts that i mentioned above, and upon checking the classpath i found these entries:
%DERBY_INSTALL%\lib\derbyclient.jar;
%DERBY_INSTALL%\lib\derby.jar;
%DERBY_INSTALL%\lib\derbytools.jar;
%DERBY_INSTALL%\lib\derbynet.jar;
The Error:
java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at Database.<init>(Database.java:14)
at TestKlient.main(TestKlient.java:8)

Categories

Resources