-1

使用 Intellij 和 Tomcat7,我正在尝试运行我的war exploded应用程序,但遇到错误。

使用 ANT(在 Intelij 之外)编译的相同应用程序工作正常,没有错误。

它失败并显示以下日志:

"C:\Program Files\Java\jdk1.7.0_07\bin\java" -Dcatalina.base=C:\Users\myname\.IntelliJIdea11\system\tomcat\Unnamed_my_portal_2 "-Dcatalina.home=C:\Program Files\Apache Software Foundation\Tomcat 7.0" "-Djava.io.tmpdir=C:\Program Files\Apache Software Foundation\Tomcat 7.0\temp" -cp "C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Tomcat 7.0\bin\tomcat-juli.jar" org.apache.catalina.startup.Bootstrap start
Dec 11, 2012 6:27:07 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.7.0_07\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 11.1.3\bin\..\.\bin;C:\Program Files (x86)\IBM\RationalSDLC\common;C:\Program Files (x86)\IBM\RationalSDLC\Clearquest\cqcli\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\mycompany\Endpoint Security Agent\Endpoint Common\bin;C:\Program Files (x86)\Common Files\Check Point\UIFramework 3.0\Bin\;C:\Program Files (x86)\mycompany\Endpoint Security\Endpoint Common\bin;x:\Bin;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\CVSNT\;c:\program files (x86)\jetbrains\intellij idea 11.1.3\jre\jre\bin;.
Dec 11, 2012 6:27:08 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Dec 11, 2012 6:27:08 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Dec 11, 2012 6:27:08 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1018 ms
Dec 11, 2012 6:27:08 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Dec 11, 2012 6:27:08 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.30
Dec 11, 2012 6:27:08 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Users\myname\.IntelliJIdea11\system\tomcat\Unnamed_my_portal_2\conf\Catalina\localhost\ROOT.xml
Dec 11, 2012 6:27:10 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
    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:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
    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:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Class.java:2308)
    at java.lang.Class.getDeclaredFields(Class.java:1760)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:87)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:90)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
    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.StandardContext.startInternal(StandardContext.java:5173)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    ... 11 more
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
    ... 25 more

Dec 11, 2012 6:27:10 PM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor C:\Users\myname\.IntelliJIdea11\system\tomcat\Unnamed_my_portal_2\conf\Catalina\localhost\ROOT.xml
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:904)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:618)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:650)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1582)
    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:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

Dec 11, 2012 6:27:10 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Dec 11, 2012 6:27:10 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Dec 11, 2012 6:27:10 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 1930 ms
Connected to server

我做错了什么?我需要做什么来解决这个问题?将来我能做些什么来防止这种情况发生?

4

1 回答 1

1

使用行家?看起来您的部署配置中没有包含 Maven 依赖项。

在 applicationContext 上找不到一个类,这意味着您的部署环境找不到 spring jar。

在 intellij 中,确保在项目结构中正确添加库。

于 2012-12-11T16:52:43.703 回答