I am running a test case using java & fitnesse...
while Clicking on the "Test" button from below image,
It showing error as follows:
Standard Error:
Exception in thread "main" java.lang.NoClassDefFoundError: ":build/classes://////var/www/git/vodaware/java/Build:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/mockito-all-1/9/5/jar:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/jsp-api/jar:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/testng-6/8/7/jar:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/servlet-api/jar:/root/leadout-tests///////var/www/git/vodaware/java/supportLibs/jcip-annotations-1/0/jar
Caused by: java.lang.ClassNotFoundException: ":build.classes:......var.www.git.vodaware.java.Build:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.mockito-all-1.9.5.jar:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.jsp-api.jar:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.testng-6.8.7.jar:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.servlet-api.jar:.root.leadout-tests.......var.www.git.vodaware.java.supportLibs.jcip-annotations-1.0.jar
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: ":build/classes:../../var/www/git/vodaware.java/Build:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/mockito-all-1.9.5.jar:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/jsp-api.jar:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/testng-6.8.7.jar:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/servlet-api.jar:/root/leadout-tests/../../var/www/git/vodaware.java/supportLibs/jcip-annotations-1.0.jar. Program will exit.
What is the cause of this logs? Please anyone help me.
As the error says, the program is not able to find the java class. You need to make sure the
class path is set properly and also make sure the package location is set properly.
Ex:
classpath: foo/bar/
package: jane/doe.class
See to it that you mention the package hierarchy properly while setting it in the fitnesse column.
Hope this helps.
Related
I am trying to run the example code provided with the JPVM,the java version of PVM.
I am able to start the JPVM daemon without any errors but when I try to run the example provided I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: jpvm/jpvmException
Caused by: java.lang.ClassNotFoundException: jpvm.jpvmException
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: hello. Program will exit.
I was running the examples from the examples directory, I copied the .class files into the JPVM root directory and ran them from there and it worked.
apparently the jPVM root directory is the working directory and examples need to be ran from there.
I'm trying to run a map reduce job. I created a runnable jar using eclipse and my input format class and output format class are in the same package as the class which starts the job. All these are included in the jar. I set the input and output format class as follows:
job.setInputFormatClass(fully_qualified_name_of_my_input_class.class);
job.setOutputFormatClass(fully_qualified_name_of_my_output_class.class);
But when i execute the jar using hadoop jar myJar.jar i get class not found exception for my output format class but i don't get it for my input format class. How to rectify this?? Here the stacktrace
java.lang.RuntimeException: java.lang.ClassNotFoundException: my-class-name
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:867)
at org.apache.hadoop.mapreduce.JobContext.getOutputFormatClass(JobContext.java:235)
at org.apache.hadoop.mapred.Task.initialize(Task.java:513)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:353)
at org.apache.hadoop.mapred.Child$4.run(Child.java:255)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:416)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1121)
at org.apache.hadoop.mapred.Child.main(Child.java:249)
Caused by: java.lang.ClassNotFoundException: my-class-name
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:266)
at org.apache.hadoop.conf.Configuration.getClassByName(Configuration.java:820)
at org.apache.hadoop.conf.Configuration.getClass(Configuration.java:865)
... 8 more
Try adding the following when you're setting up your job.
job.setJarByClass(fully_qualified_name_of_my_input_class.class)
See Hadoop query regarding setJarByClass method of Job class for more info.
ClassNotFoundException is thrown because JVM is not able to find the class. This can be due to following :-
Really desire class is missing.
Class is there but due to some error. JVM not able to find it.
In 1st case, add the class
In 2nd Case, delete all the class file in bin folder and clean the project.
Now re-run your code. It will resolve the exception.
I am trying to run this command on linux... compilation is successfull but while running it gives error.
Executing this command:
java -cp .:/smash/same/hope/ant-launcher-1.6.1.jar src.vp
output
Setting the value for property-debug
Fusion Repository/asd/file/repo
Logs Directory
Running validations
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/Project
at src.vp.call(vp.java:114)
at src.vp.main(vp.java:172)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Project
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:264)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
... 2 more
Can some one help me to solve it...
You've included the ant-launcher jar file, but that doesn't contain the whole of ant, I'm sure. Look for the ant jar file that includes the Project class. (I'd expect it to be ant-1.6.1.jar based on the other file you've specified.)
Using Ant to compile simple Hello World program in Java, and something isn't working right. I know the Java code is correct, as it runs using javac. Something is wrong with my Any config file, and I can't quite figure out what it is. http://pastebin.com/q50L5b0D
and the command line errors I'm getting:
**Exception in thread "main" java.lang.NoClassDefFoundError: Proj0/class
Caused by: java.lang.ClassNotFoundException: Proj0.class
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: Proj0.class. Program will exit.
**
It just tell you the class Proj0 could not be found when trying to run your application using the ANT target you defined. Are you sure this line is correct ?
<property name="Proj0.class" value="package.names.Proj0"/>
The package.names.Proj0 is a strange name for a package, maybe you wanted something like using the actual value of a property called package.names?
For your javac task need to set the classpath , srcdir properly. As Vincent wrote you are missing the Proj0 class. Please look here for how to set the javac task.
my program is in package pl.edu.uj.tcs.crazySocket; due to some requirements. I work in the crazySocket directory. In order to compile the program I use command
CLASSPATH=~/prog/colosseum/data javac tictactoe.java
and that succeeds. I want to run the program. I change javac to java and get rid of the '.java'. I get
Exception in thread "main" java.lang.NoClassDefFoundError: tictactoe
Caused by: java.lang.ClassNotFoundException: tictactoe
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
when I get up in the tree directory to the ~/prog/colosseum/data and run java pl/edu/uj/tcs/crazySocket/tictactoe all works fine.
What's wrong with the CLASSPATH? Shouldn't it work both with javac and java?
There's nothing wrong with your classpath, it's your call to java that's wrong.
You need to specify the full qualified class name pl.edu.uj.tcs.crazySocket.tictactoe.