2011-11-03 91 views
0

我正在嘗試使用SpringSource工具套件瞭解Spring。在這個階段,我還沒有很多成功的經驗。SpringSource工具套件 - 無法運行Spring模板項目

到目前爲止,我已經能夠安裝STS並創建一個新項目,但沒有得到更多。在tc服務器上運行應用程序時,問題似乎就會發生。我會通過我已經採取的步驟,也許有人可以指出我要去哪裏錯了。爲了記錄,我使用的是Ubuntu 11.10。

  • 我安裝使用this link,這是我的 SpringSource工具套件下載頁上找到STS。
  • 在安裝STS期間,我選擇安裝在我的主文件夾 /home/luke/springsource。我選擇了所有的包: SpringSource Tool Suite 2.8.0.RELEASE; vFabric tc服務器 2.6.1.RELEASE; Spring Roo 1.1.5.RELEASE; Apache Maven 3.0.3
  • 選擇JDK路徑時,我選擇了/ usr/lib/jvm/default-java,其中 鏈接到/ usr/lib/jvm/java-6-openjdk。
  • 安裝成功完成,我通過 手動啓動STS,進入安裝目錄 /home/luke/springsource/sts-2.8.0.RELEASE並執行文件STS。 我不得不這樣做,讓STS運行,儘管檢查框到 現在在安裝結束時運行STS(不知道這是否是一個真正的 問題,但認爲它值得一提)。
  • 我選擇我的工作空間 /home/luke/Documents/workspace-sts-2.8.0.RELEASE並單擊確定。那麼 這麼好?
  • 在儀表板中,單擊創建> Spring模板項目。
  • 在下面的對話框中,我單擊Spring MVC Project,然後單擊Next, ,然後同意下載。
  • 在項目設置對話框中,我給項目一個名稱springmvc, 和一個有效的頂層包,然後單擊完成。
  • 我現在可以在Package Explorer中看到我新創建的項目,如 以及Servers窗口中的Servers文件夾以及VMware vFabric tc Server Developer版本v2.6。
  • 我將項目拖到服務器窗口中的服務器上,項目 出現在那裏,並顯示[同步]狀態。然後在Package Explorer中右鍵單擊 項目,然後單擊運行方式>在服務器上運行。 上述服務器在那裏並被選中,所以我單擊下一步。我創建的 項目位於下一個屏幕的已配置部分,因此我點擊完成 。我被問到是否要使用Spring Insight,因此我點擊 是,服務器啓動。

這是大麻煩開始的地方。

  • 我得到以下輸出到控制檯和一個404的消息在 瀏覽器窗口,它指出在http://localhost:8080/springmvc/

控制檯輸出:

Nov 3, 2011 4:21:29 PM com.springsource.tcserver.security.PropertyDecoder <init> 
INFO: tc Runtime property decoder using memory-based key 
Nov 3, 2011 4:21:30 PM com.springsource.tcserver.security.PropertyDecoder <init> 
INFO: tcServer Runtime property decoder has been initialized in 924 ms 
Nov 3, 2011 4:21:32 PM org.apache.coyote.AbstractProtocol init 
INFO: Initializing ProtocolHandler ["http-bio-8080"] 
Nov 3, 2011 4:21:32 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init 
INFO: Started up JMX registry on 127.0.0.1:6969 in 368 ms 
Nov 3, 2011 4:21:32 PM org.apache.catalina.startup.Catalina load 
INFO: Initialization processed in 3809 ms 
Nov 3, 2011 4:21:32 PM org.apache.catalina.core.StandardService startInternal 
INFO: Starting service Catalina 
Nov 3, 2011 4:21:32 PM org.apache.catalina.core.StandardEngine startInternal 
INFO: Starting Servlet Engine: VMware vFabric tc Runtime 2.6.1.RELEASE/7.0.20.B.RELEASE 
Nov 3, 2011 4:21:32 PM org.apache.catalina.startup.HostConfig deployDescriptor 
INFO: Deploying configuration descriptor springmvc.xml from /home/luke/springsource/vfabric-tc-server-developer-2.6.1.RELEASE/spring-insight-instance/conf/Catalina/localhost 
Nov 3, 2011 4:21:33 PM org.apache.catalina.startup.SetContextPropertiesRule begin 
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:springmvc' did not find a matching property. 
Nov 3, 2011 4:21:33 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start 
INFO: Context [localhost|springmvc] will not be woven 
Nov 3, 2011 4:21:34 PM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener 
java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextException 
    at java.lang.Class.getDeclaredConstructors0(Native Method) 
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2406) 
    at java.lang.Class.getConstructor0(Class.java:2716) 
    at java.lang.Class.newInstance0(Class.java:343) 
    at java.lang.Class.newInstance(Class.java:325) 
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:119) 
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4660) 
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226) 
    at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221) 
    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:679) 
Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContextException 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678) 
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523) 
    ... 14 more 
Nov 3, 2011 4:21:34 PM org.apache.catalina.core.StandardContext listenerStart 
SEVERE: Skipped installing application listeners due to previous error(s) 
Nov 3, 2011 4:21:34 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Error listenerStart 
Nov 3, 2011 4:21:34 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom 
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [227] milliseconds. 
Nov 3, 2011 4:21:34 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Context [/springmvc] startup failed due to previous errors 
Nov 3, 2011 4:21:34 PM org.apache.catalina.startup.HostConfig deployDescriptor 
INFO: Deploying configuration descriptor insight.xml from /home/luke/springsource/vfabric-tc-server-developer-2.6.1.RELEASE/spring-insight-instance/conf/Catalina/localhost 
Nov 3, 2011 4:21:41 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start 
INFO: Context [localhost|insight] will not be woven 
Nov 3, 2011 4:21:42 PM org.apache.catalina.core.ApplicationContext log 
INFO: Initializing Spring root WebApplicationContext 
Nov 3, 2011 4:22:00 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar 
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 
Nov 3, 2011 4:22:11 PM org.apache.catalina.core.ApplicationContext log 
INFO: Initializing Spring FrameworkServlet 'Spring MVC Dispatcher Servlet' 
Nov 3, 2011 4:22:18 PM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory manager 
Nov 3, 2011 4:22:18 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start 
INFO: Context [localhost|manager] will not be woven 
Nov 3, 2011 4:22:18 PM org.apache.catalina.startup.HostConfig deployDirectory 
INFO: Deploying web application directory ROOT 
Nov 3, 2011 4:22:18 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start 
INFO: Context [localhost|ROOT] will not be woven 
Nov 3, 2011 4:22:18 PM org.apache.coyote.AbstractProtocol start 
INFO: Starting ProtocolHandler ["http-bio-8080"] 
Nov 3, 2011 4:22:19 PM org.apache.catalina.startup.Catalina start 
INFO: Server startup in 46286 ms 

破譯任何幫助,找出一個解決方案,並指出我在這裏做錯了什麼似乎是一個非常簡單的STS用例,將不勝感激。

+0

你有沒有找到解決這個問題的方法?我有完全相同的問題。從其他站點看來,SpringSource提供的模板似乎是爲Spring 2設計的,而工具箱隨Spring 3提供。我嘗試使用SpringSource的插件版本與標準Eclipse安裝相同的問題,使用標準Tomcat安裝,所以這似乎與tcServer或Eclipse的自定義SpringSource版本沒有任何關係...... –

+0

看起來我沒有在部署項目之前運行maven install。這樣做然後在部署之前刷新項目(F5)似乎解決了這個問題。 – Leirith

回答

2

看起來像項目不正確部署到服務器。 服務器的上下文菜單包含一個清除它的選項。清理後,使用相同的上下文菜單併發布應用程序。 然後再試一次。

(一種其他原因對於這個問題可以是,有一個編譯失敗。)

3

同上拉爾夫。

選擇的頂級項目,去

Run As > Maven Clean 
Run As > Maven Install 
Run As > Run on Server 

,並通過正確地去了。我不知道爲什麼它在第一位失敗,或者爲什麼安裝它兩次修復它。

相關問題