首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

TOMCAT启动太慢有关问题

2011-12-23 
TOMCAT启动太慢问题启动信息如下:2009-3-5 6:03:06 org.apache.catalina.core.AprLifecycleListener init

TOMCAT启动太慢问题
启动信息如下:
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

[解决办法]
大家可以看到,大部分时间被"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秒左右. 我觉得你的这个启动信息来看,应该是正常的..

请下面高手指正.

热点排行