2011-04-04 116 views
0

我幾個月來一直在java spring項目上工作。我可以使用maven編譯它。我可以將war文件放入tomcat/webapps並運行。爲什麼我不能從eclipse運行我的Spring項目?

但我無法再在Eclipse中運行該項目。我曾經能夠。我不確定發生了什麼事情,我想我可能已經完成了mvn clean,但是我一直無法作爲服務器運行。

我使用Eclipse太陽神,與Maven插件M2E和Maven的集成爲Eclipse WTP 我運行Tomcat 6.0.29

這是我看到的錯誤,當我嘗試運行AS->運行服務器:

Apr 4, 2011 10:33:26 AM 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\jre6\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\apps\JAXWS2.2.1-20100617\jaxws-ri\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\apache-maven-2.2.1\bin;C:\Program Files\QuickTime\QTSystem\ 
Apr 4, 2011 10:33:26 AM org.apache.tomcat.util.digester.SetPropertiesRule begin 
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:my-adapter' did not find a matching property. 
Apr 4, 2011 10:33:26 AM org.apache.coyote.http11.Http11Protocol init 
INFO: Initializing Coyote HTTP/1.1 on http-8080 
Apr 4, 2011 10:33:26 AM org.apache.catalina.startup.Catalina load 
INFO: Initialization processed in 534 ms 
Apr 4, 2011 10:33:26 AM org.apache.catalina.core.StandardService start 
INFO: Starting service Catalina 
Apr 4, 2011 10:33:26 AM org.apache.catalina.core.StandardEngine start 
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29 
Apr 4, 2011 10:33:27 AM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener 
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4078) 
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) 
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) 
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) 
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445) 
    at org.apache.catalina.core.StandardService.start(StandardService.java:519) 
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) 
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) 
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) 
Apr 4, 2011 10:33:27 AM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Skipped installing application listeners due to previous error(s) 
Apr 4, 2011 10:33:27 AM org.apache.catalina.core.StandardContext start 
SEVERE: Error listenerStart 
Apr 4, 2011 10:33:27 AM org.apache.catalina.core.StandardContext start 
SEVERE: Context [/my-adapter] startup failed due to previous errors 
+3

Eclipse未正確部署項目。看起來'spring.jar'沒有被部署到正確的位置(或者完全可能)。 – 2011-04-04 17:56:27

+0

我同意@Matt Ball。我會執行Maven - >更新項目配置,然後在您的服務器實例上執行Clean ...。我已經看到我的服務器實例很多時候在eclipse中與我的pom.xml文件中的內容無關。 – hooknc 2011-04-04 18:06:23

+0

我嘗試了Maven - >更新項目配置,然後清潔。如果我想從Eclipse開始,我可以在哪裏刪除Tomcat設置? – 2011-04-04 21:20:12

回答

0

基於eclipse的tomcat安裝無法找到APR庫。將APR庫路徑添加到PATH環境變量應解決此問題。 如果您未使用APR庫,請通過tomcat的server.xml禁用它們。

相關問題