Tomcat7+Spring3异常Failed to start component
我做的一个考试系统,使用了hibernate和spring,原来使用的tomcat版本是6,后来把tomcat换成了apache-tomcat-7.0.30-windows-x64,spring的版本是:3.1
结果启动tomcat时报错如下:
.6.
Feb 27, 2013 12:18:00 AM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], ra
ndom [true].
Feb 27, 2013 12:18:01 AM org.apache.catalina.core.AprLifecycleListener initializ
eSSL
INFO: OpenSSL successfully initialized (OpenSSL 1.0.1c 10 May 2012)
Feb 27, 2013 12:18:01 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-apr-8084"]
Feb 27, 2013 12:18:01 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-apr-8009"]
Feb 27, 2013 12:18:01 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1026 ms
Feb 27, 2013 12:18:01 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Feb 27, 2013 12:18:01 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.30
Feb 27, 2013 12:18:01 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\kunlunsoft\exam2\tomcat\webapps\doc
s
Feb 27, 2013 12:18:01 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\kunlunsoft\exam2\tomcat\webapps\exa
m004
Feb 27, 2013 12:18:01 AM org.apache.catalina.loader.WebappClassLoader validateJa
rFile
INFO: validateJarFile(C:\kunlunsoft\exam2\tomcat\webapps\exam004\WEB-INF\lib\ser
vlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending c
lass: javax/servlet/Servlet.class
Feb 27, 2013 12:18:08 AM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngin
e[Catalina].StandardHost[localhost].StandardContext[/exam004]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1100)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig
.java:1618)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.springframework.web.SpringServletContainerInitializer.onStartup(S
pringServletContainerInitializer.java:142)
at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:5274)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
Feb 27, 2013 12:18:08 AM org.apache.catalina.startup.HostConfig deployDirectory
SEVERE: Error deploying web application directory C:\kunlunsoft\exam2\tomcat\web
apps\exam004
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catal
ina.LifecycleException: Failed to start component [StandardEngine[Catalina].Stan
dardHost[localhost].StandardContext[/exam004]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:904)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.jav
a:1100)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig
.java:1618)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Feb 27, 2013 12:18:08 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\kunlunsoft\exam2\tomcat\webapps\hos
t-manager
Feb 27, 2013 12:18:08 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\kunlunsoft\exam2\tomcat\webapps\man
ager
Feb 27, 2013 12:18:08 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\kunlunsoft\exam2\tomcat\webapps\ROO
T
Feb 27, 2013 12:18:08 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-apr-8084"]
Feb 27, 2013 12:18:08 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-apr-8009"]
Feb 27, 2013 12:18:08 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 7167 ms
解决办法:
后来 在网上查了好长时间,看到了如下文章:
http://hi.baidu.com/renyijiu/item/9dfda05328afe7464eff20b7
把 spring 的版本更新为3.2.1.RELEASE ,问题就解决了。