---
title: "[zz] tomcat启动不了的原因积累"
author: "tkiicpp"
date: "2011-03-31T10:50:10Z"
tags: []
categories: ["企业架构"]
slug: "zz-tomcat"
draft: false
lastmod: "2011-03-31T14:13:13Z"
id: 981504
url: "https://tkiicpp.iteye.com/blog/981504"
---

### 原帖地址: http://bbs.tarena.com.cn/archiver/tid-36549.html

----------------------------------------------1-------------------------------------------------------------------

可能情况一：  
在安装目录下的common\\lib中加入了struts中的 lib包中的commons-beanutils.jar或者commons-digester.jar，  
解决方法：去掉！如需使用放在其他路径下，再配置环境变量！错误环境：tomcat4.31  struts1.2.7

可能情况二：  
tomcat的默认端口是8080，可能已经被其他占用。  
解决方法：在安装路径下conf文件夹中的server.xml中把断口号改掉！

可能情况三：  
环境变量有问题，仔细检查

可能情况四：  
如果本机器上有两个版本的tomcat ，在配置环境变量CATALINA\_HOME时，不能把两个的都配进去。如果配进去可能导致，在启动tomcat时，出现启动的dos界面但是没有任何提示或者是启动时的初始化的文件。  
解决办法：修改CATALINA\_HOME，用哪个tomcat就配置哪个。

可能情况五：  
可能是tomcat版本和jdk的版本不匹配，可以换一个版本的jdk试试。如tomcat4.31  &  jdk1.4.1  就出现这个问题，在更换成jdk1.4.2 后就能启动了。

可能情况六：  
C:\\Program Files\\Apache Group\\Tomcat 4.1\\bin&gt;catalina  run             //查看错误信息  
count = 6092, total = 9352  
Error occurred during initialization of VM             //提示初始化虚拟机时出错  
java/lang/NoClassDefFoundError: java/lang/Object  
这是很奇怪的错误，什么都没改，怎么虚拟机也能出错呀？不知为什么会出现这个错误。  
解决办法：重启机器后，就好了！

 

------------------------------------------------------2-----------------------------------------------------------------------

tomcat启动不了，除了上述可能的六种情况外，在建成eclipse中建web工程时也会常出现启动失败或不能启动现象：  
可能原因 1：  
       在eclipse中绑定的tomcat没有正确的设置，或者是在eclipse中的选择的和本机中安装的版本不配套。  
解决方案：  
      正确的设置eclipse 中的tomcat ，在重新设置之前，先把以前设的置的先删除，然后再按步重新绑定一个tomcat  
可能原因2：  
       在web工程中启动tomcat时可能会有端口点用，或者提示也有另外一个程序正在使用，此时可能是由于你的后台可能正在有一个tomcat正在运行，或者以前没有正在确的关闭退出tomcat。  
解决方案：  
       一般进入tomcat的安装目录下，进入bin目录，多执行下shutdown命令即可排除，注意在unix环境下，应该通过终端进入tomcat安装目 录下的bin目录执行shutdown.sh  ,在windows环境下直接执行shutdown批处理文件即可。  
tomcat在启动过程中还会有许多情况下会启动失败（ 多在建web项目时常见），但太多情况都是由于配置文件的问题，只要大家平时多总结下经验，平时多细心点去检查配置文件，就不会有什么问题。

 

------------------------------------------------------3-------------------------------------------------------------------------

最近 一段时间 [tomcat](http://www.bokee.net/searchmodule/weblogtag/search_search.do?query=tomcat&type=3 "tomcat 搜索该标签相关文章")   启动 每次都需要消耗 5～10min时间 没有 任何相应  
使用了 各种方法 都没有能够 找到 问题  
今日 修改了 conf/logging 的日志输出 级别， 终于 看到了 tomcat在启动的时候在什么  
tomcat  会扫描  /WEB-INF/ 下的 所有文件  
而我在 WEB-INF/  有 几十G的文件  
这就是 原因. 5.5.23 好像 解决了这个问题  好像

 

------------------------------------------------------4--------------------------------------------------------------------------

```
Mar 31, 2011 2:05:22 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Genuitec\Common\binary\com.sun.java.jdk.win32.x86_1.6.0.013\bin;D:\CHENPP-WORK\Compliance\blazeds-turnkey-4.0.0.14931\tomcat\bin
Mar 31, 2011 2:05:22 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8400
Mar 31, 2011 2:05:22 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 444 ms
Mar 31, 2011 2:05:22 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Mar 31, 2011 2:05:22 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.14
******************************************************************************
*                                                                            *
*  Unable to connect to the samples database.                                *
*  You must start the samples database before you can run the samples.       *
*  To start the samples database:                                            *
*    1. Open a command prompt and go to the {install-dir}/sampledb dir       *
*    2. Run startdb.bat (Windows) or startdb.sh (Unix-based systems)         *
*                                                                            *
******************************************************************************
Mar 31, 2011 2:05:33 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\CHENPP-WORK\Compliance\blazeds-turnkey-4.0.0.14931\tomcat\webapps\RestrictedListAdmin\WEB-INF\lib\servlet-api-2.4.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
log4j:WARN Continuable parsing error 4 and column 69
log4j:WARN Document root element "log4j:configuration", must match DOCTYPE root "null".
log4j:WARN Continuable parsing error 4 and column 69
log4j:WARN Document is invalid: no grammar found.
2011-03-31 14:05:36,970 (AbstractApplicationContext.java:412) INFO  - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6cc2a4: display name [org.springframework.context.support.ClassPathXmlApplicationContext@6cc2a4]; startup date [Thu Mar 31 14:05:36 CST 2011]; root of context hierarchy
2011-03-31 14:05:37,339 (XmlBeanDefinitionReader.java:323) INFO  - Loading XML bean definitions from class path resource [jms.xml]
2011-03-31 14:05:37,568 (AbstractApplicationContext.java:427) INFO  - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@6cc2a4]: org.springframework.beans.factory.support.DefaultListableBeanFactory@57f57f
2011-03-31 14:05:37,761 (DefaultListableBeanFactory.java:414) INFO  - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@57f57f: defining beans [connectionFactory,restrictedListPublishDestination,restrictedListPublisher,privateRestrictedListPublishDestination,privateRestrictedListPublisher,watchedListPublishDestination,watchedListPublisher,hasPublishDestination,hasPublisher,restrictedListDataPublisher,subscribeDestination,subscribeConsumer]; root of factory hierarchy
Initializing DeamonSession
2011-03-31 14:05:38,764 (AbstractApplicationContext.java:412) INFO  - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@dcdffc: display name [org.springframework.context.support.ClassPathXmlApplicationContext@dcdffc]; startup date [Thu Mar 31 14:05:38 CST 2011]; root of context hierarchy
2011-03-31 14:05:38,764 (XmlBeanDefinitionReader.java:323) INFO  - Loading XML bean definitions from class path resource [jms.xml]
2011-03-31 14:05:38,922 (AbstractApplicationContext.java:427) INFO  - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext@dcdffc]: org.springframework.beans.factory.support.DefaultListableBeanFactory@47b35d
2011-03-31 14:05:38,922 (DefaultListableBeanFactory.java:414) INFO  - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@47b35d: defining beans [connectionFactory,restrictedListPublishDestination,restrictedListPublisher,privateRestrictedListPublishDestination,privateRestrictedListPublisher,watchedListPublishDestination,watchedListPublisher,hasPublishDestination,hasPublisher,restrictedListDataPublisher,subscribeDestination,subscribeConsumer]; root of factory hierarchy
2011-03-31 14:08:23,771 (FailoverTransport.java:745) INFO  - Successfully connected to tcp://192.168.58.50:61616
Mar 31, 2011 2:08:24 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8400
Mar 31, 2011 2:08:24 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Mar 31, 2011 2:08:24 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/53  config=null
Mar 31, 2011 2:08:24 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 162182 ms
```

 上面的信息是tomcat启动时console打印出来内容，今天启动tomcat时，信息打印到了非蓝色字体部分便停住不动，tomcat启动不起来。我找了一上午，查看了以上列出的三部分的可能情况，还是一无所获。最后自己对比了下今天的代码和昨天的有什么不同，发现原来jms.xml中activemq由远程的改成自己本机的了。难道是activemq没有启动，我试着将本机的activemq启动，终于出现了蓝色字体信息，tomcat启动成功。原来DeamonSession类会引用到activemq，这样tomcat就一直等待起来。这也是tomcat启动不成功的另外一直情形了。