In my program I have several modules placed in different folders and all of them are dependent on a "core" module.
I have already setup a configuration for Intellij to run the program, but every time I try to run I receive a ClassNotFound Excpetion. I'm not sure if this is due to my core module having a similar packages i.e. com.adpetlabs.flappybird
Could the problem be related to the packages or something else? I really need help in resolving this
Stacktrace:
Exception in thread "main" java.lang.ClassNotFoundException: com.adeptlabs.flappybird.desktop.DesktopLauncher
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 com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
Related
I have one app which I want to dockerize. But first, I need to run it via console(cmd or bash). When I run it from Eclipse everything is okay, but when I run it from bash(java -jar project-18.5.0-SNAPSHOT.jar) I get this error
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at com.hp.spacecat.util.PropertyUtil.<clinit>(PropertyUtil.java:35)
at com.hp.spacecat.SpaceCat.main(SpaceCat.java:76)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
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)
... 2 more
I have that jar in m2 and he has this LogFactory class. Mvn clean install is success. But for some reason I can't run it via console. I don't know is there some way to get that classpath from Eclipse or there is another way to solve this.
Similar questions about this logging exception didn't help me.
I am not particularly well experienced with Java at all and try to get a jar file running on my Ubuntu machine (https://sites.google.com/site/communitydetectionslpa/home).
However once I run the jar file with the command suggested by developers I receive the following error:
java -jar GANXiSw.jar -i test.ipairs
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/collections/map/MultiKeyMap
at Net.<init>(Net.java:38)
at SLPAw.<init>(SLPAw.java:146)
at SLPAw.main(SLPAw.java:2050)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.collections.map.MultiKeyMap
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
Apparently java is not able to import the org.apache.commons class properly. After some researching I checked if I have libcommons-collections3-java installed, which however is the case.
I read something about adding the library explicitly to my CLASSPATH, which however I also read to be not good practice.
What is the best approach to fix my issue?
I use Intelij Idea. On project i use http://www.simplejavamail.org . After build and test run on server i got error:
Exception in thread "main" java.lang.NoClassDefFoundError:
org/slf4j/LoggerFactory
at org.simplejavamail.util.ConfigLoader.<clinit>(ConfigLoader.java:55)
at org.simplejavamail.email.EmailBuilder.<init>(EmailBuilder.java:153)
at com.company.Main.main(Main.java:186) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more
After googleing i add slf4j-simple-1.7.25.jar to libraries, but after build it cause that same error. It's strange because if i trying import it in any project file IDE suggest it. I also try add slf4j-api-1.7.25.jar, slf4j-jdk14-1.7.25.jar but it's stil doesnt't help.
Sorry if i don't write important informations. It's my first java project.
I am getting a NoClassDefFound error when trying to run Spark. I cannot figure out the reason behind this. Please help.
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/spark/sql/SchemaRDD
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at org.apache.spark.deploy.SparkSubmit$.org$apache$spark$deploy$SparkSubmit$$runMain(SparkSubmit.scala:659)
at org.apache.spark.deploy.SparkSubmit$.doRunMain$1(SparkSubmit.scala:180)
at org.apache.spark.deploy.SparkSubmit$.submit(SparkSubmit.scala:205)
at org.apache.spark.deploy.SparkSubmit$.main(SparkSubmit.scala:120)
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.sql.SchemaRDD
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 10 more
NoClassDefFoundError means Java couldn't find the Class it was looking for. That normally means:
You defined wrongly the classpath.
Java is finding and using the wrong version of the jar (probably because of Maven dependency hell).
Solution for 1 is to check the classpath: make sure you are including the jar that defines org.apache.spark.sql.SchemaRDD.
Solution for 2 is to check if you have a Maven dependency that depends (transitively) on an older version of the resource that defines that class.
When I try to simulate my little project, I decided to use jme3 library and browsed the jar file through Configure-> JDK Profiles-> Add Archieve-> JME3-core.jar and ran the project sample code. The code was written in a website and I got the exception as:
Mar 25, 2014 10:53:44 AM com.jme3.system.JmeSystem checkDelegate
SEVERE: No JmeSystemDelegate specified, cannot instantiate default JmeDesktopSystem:
{0}
java.lang.ClassNotFoundException: com.jme3.system.JmeDesktopSystem
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at com.jme3.system.JmeSystem.checkDelegate(JmeSystem.java:125)
at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:96)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:129)
at Main.main(Main.java:12)
Exception in thread "main" java.lang.NullPointerException
at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:97)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:129)
at Main.main(Main.java:12)
Process completed.
Is the problem about the native libraries kind of issue which is also need to be dealt with J3D libraries? I mean, do I need to follow some instructions about installing and importing JME3 libraries? If so, can anyone tell me the instructions or where to download the correct .jar file?
find a similar discussion here ..this might be relevant ...
more on the same http://hub.jmonkeyengine.org/forum/topic/latest-jme3-sdk-update-trashed-13-of-my-installations/