我开发了一个带有jsf2和primefaces 3.2的webapp。 webapp在本地运行,在干净的tomcat7安装上没有任何问题。所以我把.war文件放在我的Linux服务器上的/ var / lib / tomcat7 / webapps中。 webapp出现在tomcat管理器中,但没有运行。如果我尝试启动它,则会出现以下错误。
"FAIL - Application at context path /LnB-Sports could not be started"
"FAIL - Encountered exception org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([after_stop]) for component [org.apache.catalina.startup.FailedContext@130cd4a] in state [FAILED]"
这是 catalina.out
Jun 10, 2013 9:45:58 AM org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/LnB-Sports]
Jun 10, 2013 9:45:58 AM org.apache.catalina.util.LifecycleBase destroy
WARNING: Calling stop() on failed component [{0}] to trigger clean-up did not complete.
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([after_stop]) for component [org.apache.catalina.startup.FailedContext@b1666d] in state [FAILED]
at org.apache.catalina.util.LifecycleBase.invalidTransition(LifecycleBase.java:408)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:249)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:272)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1043)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1272)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1450)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:295)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1379)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1537)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1547)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1526)
at java.lang.Thread.run(Thread.java:722)
Jun 10, 2013 9:45:58 AM org.apache.catalina.startup.HostConfig checkResources
WARNING: Error while removing context [/LnB-Sports]
java.lang.ClassCastException: org.apache.catalina.startup.FailedContext cannot be cast to org.apache.catalina.core.StandardContext
at org.apache.catalina.startup.ContextConfig.destroy(ContextConfig.java:1074)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:365)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:312)
at org.apache.catalina.core.ContainerBase.removeChild(ContainerBase.java:1043)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1272)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1450)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:295)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1379)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1537)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1547)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1526)
at java.lang.Thread.run(Thread.java:722)
Jun 10, 2013 9:53:24 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:53:24 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:53:24 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Jun 10, 2013 9:53:24 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:53:24 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:53:24 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:53:24 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:53:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:53:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:53:28 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2948 ms
Jun 10, 2013 9:53:28 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 10, 2013 9:53:28 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Jun 10, 2013 9:53:28 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/manager.xml
Jun 10, 2013 9:53:30 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/host-manager.xml
Jun 10, 2013 9:53:31 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
Jun 10, 2013 9:53:31 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:53:31 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:53:31 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3164 ms
Jun 10, 2013 9:58:56 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:58:56 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:58:56 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Jun 10, 2013 9:58:56 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:58:56 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:58:56 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:58:56 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:59:01 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:59:01 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:59:01 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2986 ms
Jun 10, 2013 9:59:01 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 10, 2013 9:59:01 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.26
Jun 10, 2013 9:59:01 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/manager.xml
Jun 10, 2013 9:59:06 AM org.apache.catalina.util.SessionIdGenerator createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [3,329] milliseconds.
Jun 10, 2013 9:59:06 AM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor /etc/tomcat7/Catalina/localhost/host-manager.xml
Jun 10, 2013 9:59:06 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/LnB-Sports.war
Jun 10, 2013 9:59:06 AM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'context/Manager'.
Jun 10, 2013 9:59:06 AM org.apache.tomcat.util.digester.Digester endElement
WARNING: No rules found matching 'context'.
Jun 10, 2013 9:59:07 AM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.startup.FailedContext@60659b]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.catalina.LifecycleException: Failed to process either the global, per-host or context-specific context.xml file therefore the [/LnB-Sports] Context cannot be started.
at org.apache.catalina.startup.FailedContext.startInternal(FailedContext.java:153)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
Jun 10, 2013 9:59:07 AM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive /var/lib/tomcat7/webapps/LnB-Sports.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.startup.FailedContext@60659b]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:898)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:958)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1599)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Jun 10, 2013 9:59:07 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
Jun 10, 2013 9:59:07 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 10, 2013 9:59:07 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 10, 2013 9:59:07 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6362 ms
感谢您的帮助:)
答案 0 :(得分:1)
java.lang.ClassCastException: org.apache.catalina.startup.FailedContext cannot be cast to org.apache.catalina.core.StandardContext
这表明运行时类路径由于某种原因被多个不同版本的Tomcat内部库污染,例如catalina.jar
。那些多个不同版本的库彼此冲突。
您需要确保您的网络应用/WEB-INF/lib
不包含任何特定于servletcontainer的JAR文件,例如catalina.jar
,servlet-api.jar
等。它会使你的webapp只与JAR最初来自的特定servletcontainer make / version兼容,并且完全不能移植到另一个servletcontainer品牌/版本。您还需要确保不要触及Tomcat自己的/lib
文件夹,也不要触及JRE / JDK自己的/lib
或/lib/ext
,它们也会在运行时类路径中进行模式化(除非您真的知道你正在做什么,但不理解这个ClassCastException
表明情况还不是这样。)