While I am running Main class related to Jar file I got following error. Some one please help me. Thanks.
D:\data\Gateway\dist>java -jar Gateway.jar com.Application
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/context/support/AbstractApplicationContext
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.springframework.context.support.AbstractApplicationContext
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)
... 6 more
The message
java.lang.NoClassDefFoundError:
org/springframework/context/support/AbstractApplicationContext
indicates that the jar org.springframework.context must be added to the classpath.
Related
I want to use JUnit tester to my Java program, but I got java.lang.NoClassDefFoundException. As I read this may got if I don't have .class file. But, since first I use it with javac, as I think it must be there.
Here is my command line:
myComputer\java\bead2>javac -cp .;junit-4.12.jar;hamcrest-core-1.3.jar
snake\tests\ToApplesTest.java
myComputer\java\bead2>java -cp .;junit-4.12.jar;hamcrest-core-1.3.jar
org.junit.runner.JUnitCore snake\tests\ToApplesTest
JUnit version 4.12
Exception in thread "main" java.lang.NoClassDefFoundError: snake\tests\ToApplesTest (
wrong name: snake/tests/ToApplesTest)
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.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)
at org.junit.internal.Classes.getClass(Classes.java:16)
at org.junit.runner.JUnitCommandLineParseResult.parseParameters(JUnitCommandL
ineParseResult.java:100)
at org.junit.runner.JUnitCommandLineParseResult.parseArgs(JUnitCommandLinePar
seResult.java:50)
at org.junit.runner.JUnitCommandLineParseResult.parse(JUnitCommandLineParseRe
sult.java:44)
at org.junit.runner.JUnitCore.runMain(JUnitCore.java:72)
at org.junit.runner.JUnitCore.main(JUnitCore.java:36)
Why this crashing for me?
Try snake.tests.ToApplesTest. You must provide a package name, not a path to the containing folder.
When i run my maven project from eclipse it runs ok. But when i run it from cmd line as a jar file i have the following error:
A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: edu/mit/jwi/IDictionary
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: edu.mit.jwi.IDictionary
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
But i don't use the
IDictionary.class
in my project, instead i use the
Dictionary.class
of jwi library, so i don't understand why i have the above error and what exactly is that.
Please help!!!!
I have a javafx application that I've been developing in eclipse and it is working fine on the IDE. However, when I export it into a jar, I get the following Exception:
java.lang.NoClassDefFoundError: javafx/application/Application
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.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 sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
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)
... 13 more
Exception in thread "main"
I've even created a MainTerminal class that doesn't use javaFX, instead just interacts within the terminal and after I exported the jar using MainTerminal as the main class and it worked fine. It seems I'm not being able to export some dependency or something but I checked the buildpath and it seemed alright to me.
I feel quite dumb about this but I just found out what my problem was. I was exporting my project as a Jar instead of a runnable Jar, that's why it was throwing an exception when I tried executing it.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.util.LifecycleBase.<clinit>(LifecycleBase.java:36)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.logging.LogFactory
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)
I was trying to create wsag4j agreement service and I got this error.
You need to add apache logging library to your classpath.
You can download the library here and here you can get instructions on how to add it to classpath.
I am using QPid with Eclipse and Tomcat. Created a Dynamic Web Application and set the QPID_HOME, QPID_WORK environment variables.
Trying out the Hello.java example mentioned here:-
https://svn.apache.org/repos/asf/qpid/trunk/qpid/java/client/example/
But i am getting these errors while running this file :-
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/qpid/url/URLSyntaxException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at myApp.runTest(myApp.java:25)
at myApp.main(myApp.java:15)
Caused by: java.lang.ClassNotFoundException: org.apache.qpid.url.URLSyntaxException
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)
... 9 more
It looks like you are missing:
qpid-common-0.10.jar
Available from http://qpid.apache.org/download.html
or
<dependency>
<groupId>org.apache.qpid</groupId>
<artifactId>qpid-common</artifactId>
<version>0.10</version>
</dependency>
if you are using maven.