TOMCAT启动太慢问题

李发展
博客专家认证
2009-03-05 02:09:57
启动信息如下:
2009-3-5 6:03:06 org.apache.catalina.core.AprLifecycleListener init
信息: Loaded Apache Tomcat Native library 1.1.8.
2009-3-5 6:03:09 org.apache.coyote.http11.Http11AprProtocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2009-3-5 6:03:09 org.apache.coyote.ajp.AjpAprProtocol init
信息: Initializing Coyote AJP/1.3 on ajp-8009
2009-3-5 6:03:09 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 4625 ms
2009-3-5 6:03:09 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2009-3-5 6:03:09 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.10
2009-3-5 6:03:21 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2009-3-5 6:04:47 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2009-3-5 6:06:22 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
(0 ms) [main] WARN : com.mchange.v2.c3p0.management.ActiveManagementCoordinator#attemptManageC3P0Registry : A C3P0Registry mbean is already registered. This probably means that an application using c3p0 was undeployed, but not all PooledDataSources were closed prior to undeployment. This may lead to resource leaks over time. Please take care to close all PooledDataSources.
2009-3-5 6:07:25 org.apache.catalina.core.ApplicationContext log
信息: Set web app root system property: 'webapp.root' = [D:\Tomcat 6.0\webapps\sshnews\]
2009-3-5 6:07:25 org.apache.catalina.core.ApplicationContext log
信息: Initializing Log4J from [D:\Tomcat 6.0\webapps\sshnews\WEB-INF\log4j.properties]
2009-03-05 06:07:27 [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]-[INFO] Parsing configuration file [struts-default.xml]
2009-03-05 06:07:30 [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]-[INFO] Parsing configuration file [struts-plugin.xml]
2009-03-05 06:07:30 [com.opensymphony.xwork2.config.providers.XmlConfigurationProvider]-[INFO] Parsing configuration file [struts.xml]
2009-03-05 06:07:30 [org.apache.struts2.config.Settings]-[WARN] Settings: Could not parse struts.locale setting, substituting default VM locale
2009-03-05 06:07:32 [com.opensymphony.xwork2.spring.SpringObjectFactory]-[INFO] Setting autowire strategy to name
2009-03-05 06:07:41 [com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory]-[INFO] Setting DefaultObjectTypeDeterminer as default ...
2009-3-5 6:07:42 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2009-3-5 6:07:42 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization started
2009-3-5 6:07:44 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.web.context.support.XmlWebApplicationContext@128647a: display name [Root WebApplicationContext]; startup date [Thu Mar 05 06:07:44 GMT 2009]; root of context hierarchy
2009-3-5 6:07:46 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [applicationContext.xml]
2009-3-5 6:07:46 org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
信息: Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@128647a]: org.springframework.beans.factory.support.DefaultListableBeanFactory@1370ce9
2009-3-5 6:07:47 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1370ce9: defining beans [userAction]; root of factory hierarchy
2009-3-5 6:07:47 org.springframework.web.context.ContextLoader initWebApplicationContext
信息: Root WebApplicationContext: initialization completed in 4953 ms
2009-3-5 6:07:49 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-default.xml]
2009-3-5 6:07:51 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts-plugin.xml]
2009-3-5 6:07:51 com.opensymphony.xwork2.config.providers.XmlConfigurationProvider register
信息: Parsing configuration file [struts.xml]
2009-3-5 6:07:51 org.apache.struts2.config.Settings getLocale
警告: Settings: Could not parse struts.locale setting, substituting default VM locale
2009-3-5 6:07:52 org.apache.struts2.spring.StrutsSpringObjectFactory <init>
信息: Initializing Struts-Spring integration...
2009-3-5 6:07:52 com.opensymphony.xwork2.spring.SpringObjectFactory setAutowireStrategy
信息: Setting autowire strategy to name
2009-3-5 6:07:52 org.apache.struts2.spring.StrutsSpringObjectFactory <init>
信息: ... initialized Struts-Spring integration successfully
2009-3-5 6:07:56 com.opensymphony.xwork2.util.ObjectTypeDeterminerFactory <clinit>
信息: Setting DefaultObjectTypeDeterminer as default ...
2009-3-5 6:07:56 org.apache.coyote.http11.Http11AprProtocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2009-3-5 6:07:56 org.apache.coyote.ajp.AjpAprProtocol start
信息: Starting Coyote AJP/1.3 on ajp-8009
2009-3-5 6:07:56 org.apache.catalina.startup.Catalina start
信息: Server startup in 287703 ms



大家可以看到,大部分时间被"log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly."花费掉了。


我在网上搜这个信息,试了很多方法都不行。包括拷贝log4j.properties到classes目录下,还是提示这个问题,仍然启动慢。以下是lib信息:
TOMCAT_HOME/lib/servlet-api.jar - D:\Tomcat 6.0\lib\servlet-api.jar
TOMCAT_HOME/lib/jasper.jar - D:\Tomcat 6.0\lib\jasper.jar
TOMCAT_HOME/lib/jsp-api.jar - D:\Tomcat 6.0\lib\jsp-api.jar
TOMCAT_HOME/lib/el-api.jar - D:\Tomcat 6.0\lib\el-api.jar
TOMCAT_HOME/lib/annotations-api.jar - D:\Tomcat 6.0\lib\annotations-api.jar
antlr-2.7.6.jar
aopalliance.jar
c3p0-0.9.1.2.jar
cglib-nodep-2.1_3.jar
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
dom4j-1.6.1.jar
ehcache-1.1.jar
freemarker-2.3.8.jar
hibernate3.jar
jsonplugin-0.7.jar
jta.jar
mysql-connector-java-3.1.10-bin.jar
ognl-2.6.11.jar
saaj.jar
spring-mock.jar
spring.jar
struts-core-1.3.5.jar
struts2-core-2.0.11.jar
struts2-spring-plugin-2.0.11.jar
xwork-2.0.4.jar
jdom.jar
ant.jar
jaxen-core.jar
jaxen-jdom.jar
saxpath.jar
xalan.jar
xerces.jar
xml-apis.jar
commons-logging-1.0.4.jar
commons-logging.jar
log4j-1.2.13.jar
...全文
3565 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
ttsoft888 2011-10-27
  • 打赏
  • 举报
回复
我的在myEclipse里启动需要6分钟,在tomcat安装目录下启动,不到1分钟,不知道为什么?
zf694142242 2010-07-29
  • 打赏
  • 举报
回复
我的文件中没有log4j文件不知到动了哪里 就出来这个
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
就是启动时到这里挺费时的撒 可不可以在启动时后不加载log4j:WARN 可以不咋配置撒 谢了
leopoincare 2010-06-25
  • 打赏
  • 举报
回复
真的跟当掉了一样
xchen1986 2010-01-21
  • 打赏
  • 举报
回复
你可以调试一下log4j的输出等级
如果你在server.xml中配置了多个服务的话,你可以在别的服务不用的时候注掉.
<Context ....
..
</Context >
还有一种可能就是spring的beans
默认default-lazy-init为false,导致在启动时候,会默认加载整个对象实例图,导致速度慢 , 把beans的default-lazy-init改为true的话,spring在启动的时候并没有真正实例化对象,而只是用一个代理来实现。当真正需要调用该类的时候,才会去实例化
citiz1212 2009-10-29
  • 打赏
  • 举报
回复
我也有这个问题,请高手指点一下吧
~
gpogpo 2009-08-31
  • 打赏
  • 举报
回复
我也有这个问题,请高手指点一下吧
~
WuBill 2009-03-05
  • 打赏
  • 举报
回复
再加1G内存,估计就不会有这烦恼了*_*
李发展 2009-03-05
  • 打赏
  • 举报
回复
删除log4j.jar现在是可以了,不会出现该问题。

如果保留log4j.jar的话,还是老样子。哪个高手可以解答下?谢谢。

如果只是把一个log4j.properties放到classes下,并在web.xml上加个配置,好像不起作用。
李发展 2009-03-05
  • 打赏
  • 举报
回复
我的是笔记本,1G内存,奔腾M1.6的。
请问具体怎么初始化log4j的系统属性。

顺便说声,我考虑开发阶段经常重启tomcat,我打算去掉log4j,我用的是ssh2的框架。
把log4j.jar去掉后,原以为不会出现“log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly”这个提示,结果还是出现了。奇怪。
goosman 2009-03-05
  • 打赏
  • 举报
回复
大家可以看到,大部分时间被"log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly."花费掉了。


这个是告诉你,你没有配置log4j的日志.并请你初始化log4j的系统属性.

log4j是用来记录日志的.

系统启动的时候.把启动记录记下来.

你这里没有配.它应该是不会是主要耗时因素吧?

你机子什么配置?我890M内存.AMD3400+cpu, tomcat上部署的系统有5个模块,启动速度是50秒左右. 我觉得你的这个启动信息来看,应该是正常的..

请下面高手指正.

58,454

社区成员

发帖
与我相关
我的任务
社区描述
Java Eclipse
社区管理员
  • Eclipse
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧