2012-12-11 112 views
-1

使用Intellij和Tomcat7,我試圖運行我的war exploded應用程序,但遇到了錯誤。Tomcat/IntelliJ運行失敗

使用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 

我做了什麼錯?我需要做些什麼來解決這個問題?我能做些什麼來預防未來呢?

+0

你的問題似乎不是關於IntelliJ或Tomcat,它似乎是在運行時(Tomcat啓動)缺少一個jar文件。 – melihcelik

回答

1

使用maven?它看起來像你的部署配置中不包括Maven依賴項。

在applicationContext上沒有找到類,這意味着您的deploy enivirnoment無法找到彈簧罐。

在intellij中確保在項目結構中正確添加了庫。