按照Appfuse的readme.txt 进行操作时,发生错误:Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher,问题及解决过程.
appfuse2.0错误处理:NoClassDefFoundError:org/codehaus/class
陈海青 2007.10.18
按照Appfuse的readme.txt 进行操作时,发生错误:Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher
具体过程如下
1:下载Appfuse2.0
2: download Maven 2.0.6, install it, and add $M2_HOME/bin to your $PATH.
Create a MAVEN_OPTS environment variable and set its value to:
-Xms512M -Xmx512M
3:Eclipse 3.2+:From the command line, cd into the appfuse directory and run:
mvn eclipse:eclipse -DdownloadSources=true
。。。。。。
此时报错:
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher
----
经检查,系环境变量设置问题,遗漏了$M2_HOME/bin,修改后,pass!
我是用了一个.bat批处理文件来设置变量,具体内容如下:
set M2_HOME=%USR_ROOT%%Home%maven-2.0.6
set MAVEN_OPTS= -Xms512M -Xmx512M
PATH=%PATH%;%JAVA_HOME%in;$M2_HOME/bin;.
以下摘录一篇类似的文章:
原文网址:http://www.milofelipe.com/
Appfuse 2.0: Errors I encountered and how I fixed them
Appfuse 2.0 has finally been released. Instead of using version 1.9.4 (the previous stable release) for an upcoming web project, I decided to use this latest version. The fastest way to learn this new version is through the Quick Start guide. I encountered errors while following this guide. I googled around and found the fixes. For those starting with Appfuse 2.0, here's a list of errors I encountered and what I did to fix them. Note: I may not be able to explain why the fixes fixed the errors.
Error: Executed 'mvn' command and got a 'Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/classworlds/Launcher'.
Fix: Set a M2_HOME environment variable. This should point to your Maven directory. Also, be sure you have JAVA_HOME setup. Appfuse 2.0 requires Maven 2.0.6+ and Java 5+.
Error: After fixing the above error, I got a "Error while expanding /tmp/cargo/installs/apache-tomcat-6.0.14.zip Unexpected end of ZLIB input stream"
Fix: Delete all files inside /tmp/cargo/installs/ (or whatever directory indicated in your case) and manually download apache-tomcat-6.0.14.zip and put it there.
Error: Executed 'mvn jetty:run-war' and got a "Failed startup of context org.mortbay.jetty.webapp.WebAppContext@4d342f5b
{/,jar:file:/.../.../.../.../web/target/..-webapp-1.0-SNAPSHOT.war!/}
java.util.zip.ZipException: error in opening zip file"
Fix: Delete everything inside ~/.m2/repository and execute the command again. This will download everything again.
I hope this post helps you. If you have other errors you encountered, please share how you fixed them. Thanks!
Posted by Milo Felipe at 9:18 AM