I setup a tomcat 6 server in Eclipse pointing to a local tomcat folder:
C:\Program Files (x86)\Apache\Tomcat
I setup a debug configuration to point to that tomcat server with the following settings:
Program arguments:
start
VM arguments:
-Dcatalina.base="C:\Program Files (x86)\Apache\Tomcat" -Dcatalina.home="C:\Program Files (x86)\Apache\Tomcat"
Classpath Bootstrap Entries:
JRE System Library [jdk]
Classpath User Entries:
bootstrap - C:\Program Files (x86)\Apache\Tomcat\bin\
tools.jar - C:\Program Files (x86)\Java\jdk\lib\
When attempting to start the debug configuration (and subsequently Tomcat), I instantly get this error in the Console:
java.lang.NoClassDefFoundError: Files
Caused by: java.lang.ClassNotFoundException: Files
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
And this error as a Windows Popup:
Java Virtual Machine Launcher - Could not find the main class Files. Program will now exit.
I think somewhere the JVM is trying to parse a "Program Files" related path, failing on the space, and thinks that "Files" is a parameter. But I don't even know where to look to find whatever path it's referencing! Is there an argument I can pass that will be verbose about what it's doing?
Install Tomcat into a directory that does not have spaces in its full path.
Such as C:\Apache\Tomcat
Related
I'm attempting to run a MapReduce job from a jar file and keep getting a ClassNotFoundException error. I'm running Hadoop 1.2.1 on a Centos 6 virtual machine.
First I compiled the file exercise.java (and class) into a jar file exercise.jar using the following shell script compile.sh :
#!/bin/bash
javac -classpath /pathto/hadoop-common-1.2.1.jar:\
/pathto/hadoop-core-1.2.1.jar /pathto/exercise.java
jar cvf exercise.jar /pathto/*.class
This runs fine and the jar completes successfully. I then attempt to run the actual MapReduce job using shell script exec.sh:
#!/bin/bash
export CLASSPATH=$CLASSPATH:/pathto/hadoop-common-1.2.1.jar:\
/pathto/hadoop-core-1.2.1.jar:/pathto/exercise.class
hadoop jar exercise.jar exercise /data/input/inputfile.txt /data/output
This trows the ClassNotFoundException error :
Exception in thread "main" java.lang.ClassNotFoundException: exercise
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 java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
I realize the explicit path names might not be necessary but I've been a little desperate to double check everything. I've confirmed that in my exercise.java file exercise.class is in the job configuration via job.setJarByClass(exercise.class); and confirmed exercise.class is contained in exercise.jar. Can't seem to figure it out.
UPDATE
The exec.sh script with the full path of exercise.class. It's stored in my Eclipse project directory:
#!/bin/bash
export CLASSPATH=$CLASSPATH:/pathto/hadoop-common-1.2.1.jar:\
/pathto/hadoop-core-1.2.1.jar:/home/username/workspace/MVN_Hadoop/src/main/java.com.amend.hadoop.MapReduce/*
hadoop jar \
exercise.jar \
/home/username/workspace/MVN_Hadoop/src/main/java.com.amend.hadoop.MapReduce/exercise \
/data/input/inputfile.txt \
/data/output
When I actually try and run the exec.sh script using the explicitly written out path names, I also get a completely different set of errors:
Exception in thread "main" java.lang.ClassNotFoundException: /home/hdadmin/workspace/MVN_Hadoop/src/main/java/come/amend/hadoop/MapReduce/exercise
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.apache.hadoop.util.RunJar.main(RunJar.java:153)
I could see this possible errors.
From the Hadoop jar exercise.jar exercise /data/input/inputfile.txt /data/output please specify the full path of the exercise class. I.e org.name.package.exercise if exists. To cross check open the jar file and check the location of exercise.class location.
To continue, Hadoop doesn't expect jars to be included within the jars, since the path of Hadoop is set globally.
NEW:
See, the following path is some thing weird. "/home/hdadmin/workspace/MVN_Hadoop/src/main/java/come/amend/hadoop/MapReduce/exercise"
If you are running using your jar, how could a class path be so specific, instead of jar path. It could only be "come/amend/hadoop/MapReduce/exercise" this.
When I am running qpid-server.bat, I am getting following error:
C:\qpid\qpid-0.24\java\broker\bin>qpid-server.bat
Warning: Qpid classpath not set. CLASSPATH set to C:\qpid\qpid-0.24\java\broker\lib\qpid-all.jar;C:\qpid\qpid-0.24\java\broker\lib\plugins\*;C:\qpid\qpid-0.24\java\broker\lib\opt\*
Info: QPID_JAVA_GC not set. Defaulting to JAVA_GC -XX:+UseConcMarkSweepGC -XX:+HeapDumpOnOutOfMemoryError
Info: QPID_JAVA_MEM not set. Defaulting to JAVA_MEM -Xmx1024m
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/qpid/server/Main
Caused by: java.lang.ClassNotFoundException: org.apache.qpid.server.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: org.apache.qpid.server.Main. Program will exit.
I am not running any code. I am just starting qpid-server.bat and getting above error.
I would be really thankful if anyone would suggest me the solution.
After downloading the code from Apache "qpid-java-6.1.0", I also had errors running the broker. I found that the broker folder I was using was incorrect. I was able to run the broker by setting the system variable QPID_HOME to "C:\qpid\qpid-java-6.1.0\systests\target\qpid-broker\6.1.0" and running the "qpid-server.bat" in that location. You can then log into the broker at "http://localhost:8080" with user = admin and password = admin. I am not sure what the "systests" folder is or why the bin and lib files are here, but it works. Navigate to that folder and look at the files there. Let me know if there is a better folder I am supposed to be in. I then create a connection factory with the URL "amqp://admin:admin#clientid/?brokerlist='tcp://localhost:5672" and it works.
I have seen this problem caused by an incorrect setting of the QPID_HOME environment variable.
With a normal installation QPID_HOME needs to refer to the immediate parent of the lib directory. The batch file tries to determine QPID_HOME if it is not set, but will use its current value otherwise. Check you have not set it erroneously.
I am having difficulty running JOGL on my mac. I am running Mac OSX 10.8.5. I followed the instructions given here:
http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE#Compile_and_run_your_project_from_the_command_line
First I downloaded jogamp-all-platforms.7z.
I copied the mac jogl jar files to /jogl2/jar, and I copied the contents of the lib folder to /jogl2/lib.
I copied gluegen-rt.jar and jogl-all.jar to /Library/Java/Extensions.
I then compiled a simple class with:
$ javac -classpath "/jogl2/jar/gluegen-rt.jar:/jogl2/jar/jogl-all.jar" /COM/Week1/JOGLtutorial/S1.java
It compiles with no errors. When trying to run the compiled program I get the following error:
$ java -classpath "/jogl2/jar/gluegen-rt.jar:/jogl2/jar/jogl-all.jar" -Djava.library.path="/jogl2/lib" /COM/Week1/JOGLtutorial/S1
Exception in thread "main" java.lang.NoClassDefFoundError: /COM/Week1/JOGLtutorial/S1
Caused by: java.lang.ClassNotFoundException: .COM.Week1.JOGLtutorial.S1
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could anyone enlighten me on my errors? I have it working fine on windows. I think the problem is something to do with incorrectly setting up environment variables.
I'm trying to create a simple Java Agent program before I implement the real thing. I cannot get it to run. Clearly I have some sort of configuration or class path problem. No amount of looking and trying has lead to me the problem.
If I run:
java -cp ./demoAgent.jar -javaagent:./demoAgent.jar com.kingtigerbooks.demoMod.Main
I get the following error:
Exception in thread "main" java.lang.ClassNotFoundException: com.kingtigerbooks.demoAgent.Agent
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:280)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338)
FATAL ERROR in native method: processing of -javaagent failed
Abort trap
I'm running this on my Mac. The jar file with the agent is in the current directory. The manifest for the jar file looks like this:
Manifest-Version: 1.0
Premain-class: com.kingtigerbooks.demoAgent.Agent
Can-Redefine-Classes: true
If smells like a class path problem, but as you can see I have included the jar on the class path. Any help would be appreciated. Its a very simple project.
Problem solved. I had a bad jar file. The agent jar file did not contain the agent class. By building the correct jar file and putting the fully qualified path to the jar on in the javaagent parameter it all works.
when you run an agent, you do not add the agent jar to the normal classpath.
as a side note, you can add -verbose:class to the command line to get info about the class loading process.
Just downloaded Tomcat 7.0.26, unzipped it, ran the startup.bat file and it failed with the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.catalina.startup.Bootstrap.<clinit>(Bootstrap.java:54)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
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)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
... 1 more
A co-worker recommended I try using an older/more stable version of Tomcat. He's running 6.0.35, so I decided to try that.
I did the same exact thing with 6.0.35...and the same thing is happening to me...
What is going on here?!?! I see in bin/tomcat-juli.jar that the LogFactory is there (both versions)...
Edit:
Here are the values for several environment variables:
CLASSPATH: .;C:\Users\<myUser>\Desktop\jars\;C:\Program Files\Java\jre6\lib\ext\QTJava.zip
JAVA_HOME: C:\Program Files\Java\jdk1.6.0_25
These don't seem to add up!?! If I'm reading this correctly, doesn't it say that the CLASSPATH thinks I'm using jre6, but that Java Home is set to jdk1.6.0_25?
It's possible that some environment variable is set in your system which is preventing Tomcat from running.
Check:
CATALINA_HOME
CATALINA_BASE
CATALINA_OPTS (for classpath additions)
JAVA_OPTS (for classpath additions)
and less likely:
LOGGING_CONFIG
LOGGING_MANAGER
If any of these environment variables are set, correct or unset them. My guess is that CATALINA_HOME is set to point to a different version of Tomcat on your system.
I have downloaded Tomcat 7.0.26 2 hours ago and its working fine. It looks like you have an old version of commons-logging.jar anywhere in your classpath (path variable, jre versions/lib, etc...).
I had same problem.
All I did was to copy all the jar files in [apache-tomcat]/lib directory and all the jar files in [apache-tomcat]/bin to [jdk directory]/jre/lib/ext directory.
This should solved the problem.