Classpath issue with Intellij Idea 2016.1.1 and Gradle - java

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

Related

When trying to run Aries2 repo, getting java.lang.NoClassDefFoundError: com/availity/aries/core/queue/QueueStorage error

When attempting to run the pdm-outbound (Aries2 app) repo, we are getting the following error. This is a new error and was not occurring last week. I have conformed that devtools is up to date and rebuilt gradle. Does anyone have any recommendations?
java.lang.NoClassDefFoundError: com/availity/aries/core/queue/QueueStorage
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2699)
at java.lang.Class.getConstructor0(Class.java:3103)
at java.lang.Class.newInstance(Class.java:412)
at com.availity.aries.core.plugin.Plugins.init(Plugins.java:207)
at com.availity.aries.Aries.start(Aries.java:259)
at com.availity.aries.Aries.bootstrap(Aries.java:146)
at com.availity.aries.Aries.main(Aries.java:74)
Caused by: java.lang.ClassNotFoundException: com.availity.aries.core.queue.QueueStorage
at java.net.URLClassLoader.findClass(URLClassLoader.java:387)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 8 more
I recreated this issue on my local. It appears like there is some issue with
com.availity.aries.core:vault:3.3.0-SNAPSHOT
So, the immediate fix would be to revert to the previous version i.e
com.availity.aries.core:vault:3.2.0-SNAPSHOT
Navigate to the devtools folder on your local machine and locate the file launcher.gradle line 57 . Revert it to the previous version as indicated above. Once this is done, execute the command
./gradle.sh clean compileJava launcher
The app should run without the error. The concerned team would look into this and get a fix ASAP.

Hadoop MapReduce ClassNotFoundException Error

I have extracted a jar from a Maven project that runs the MapReduce job. However, I keep receiving the error "java.lang.ClassNotFoundException". The things that I have tried to use to repair this is:
Configured the classpath
Tried doing job.setJar(.jar)
Attempted job.setJarbyClass(.class)
Changing JobConf path file
Caress Hadoop and tell it everything is going to be okay
I extracted the jar file from Maven and transferred it to a Linux server, and running it from there.
The full error message is:
Exception in thread "main" java.lang.ClassNotFoundException: BLAMapAttempt2
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at org.apache.hadoop.util.RunJar.run(RunJar.java:214)
at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
If there is any missing information needed to answer this question, please let me know, and thank you for reading.
When exporting the jar out of Eclipse, I unchecked "classpath" because I was not running it locally. This fixed my error.

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.

oracle.jdbc.driver.OracleDriver exception for Beginners Java

I searched a lot about this error but no solution works.
I'm just learning Java connection with Oracle.
But I'm getting this exception.
oracle.jdbc.driver.OracleDriver
I already placed ojdbc6.jar in C:\Program Files\Java\jre1.8.0_60\lib\ext now what to do next?
In few days ago I was working fine with database. But recently 2 days ago I reinstall windows not forgot how to setup it.
Here is Complete StackTrace.
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at RunQuery.main(RunQuery.java:11)
Please check this Setting multiple jars in java classpath link for adding third party jar (ojdbc6.jar) while running Java program.
and I suggest you to use latest driver jar which is compatible to JDK 8, You can check on this FAQ link http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html#01_02

Running jzy3d demos result in ClassNotFoundException

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.

Categories

Resources