Tomcat versions aren't starting

别说谁变了你拦得住时间么 提交于 2020-01-06 12:51:15

问题


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?


回答1:


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.




回答2:


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...).




回答3:


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.



来源:https://stackoverflow.com/questions/9673716/tomcat-versions-arent-starting

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!