我最近需要在MyEclipse中使用Tomcat7,已经在Servers中配置了本地的Tomcat路径,之后发布项,在MyEclipse启动Tomcat服务则出现如下错误提示:
Exception in thread “main” java.lang.NoClassDefFoundError: org/apache/juli/logging/LogFactory
at org.apache.catalina.startup.Bootstrap.(Bootstrap.java:54)
Caused by: java.lang.ClassNotFoundException: org.apache.juli.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
Could not find the main class: org.apache.catalina.startup.Bootstrap. Program will exit.
单独用D:\WorkSoft\apache-tomcat-7.0.62\bin\startup.bat启动web服务正常。
解决办法:
通过如下操作,问题解决:MyEclipse->Window->Preferences->MyEclipse->Servers->Tomcat->Tomcat 6.x->Laucch->Create Launch Configuration->Classpath->Bootstrap Entities->Add External JARs->选择并填加D:\WorkSoft\apache-tomcat-7.0.62\bin\tomcat-jjar就OK,截图如下: