2012-03-30 27 views
0

我想使用STS運行我的Spring應用程序,但我不知道如何做到這一點。我看到了tc服務器實例,並且可以運行它,但這不會啓動我的應用程序。我試過把我的項目工作區拖到它上面,但那也沒有奏效。我右鍵單擊並讀取/檢出了上下文相關菜單上的所有選項,但我沒有看到任何內容在tc服務器中運行我的項目。有誰知道如何?如何使用SpringSource Toolsuite運行Web應用程序?

編輯:

這是我運行該項目時得到的。我根本沒有看到我的項目的戰爭。當我查看tc服務器設置時,它被包含在「web模塊」中。它有一個web.xml和所有其他好東西。該項目在Maven的tomcat目標和IDEA內工作正常。我只是有問題讓它在eclipse中運行。

Mar 30, 2012 3:35:51 PM com.springsource.tcserver.security.PropertyDecoder <init> 
INFO: tc Runtime property decoder using memory-based key 
Mar 30, 2012 3:35:51 PM com.springsource.tcserver.security.PropertyDecoder <init> 
INFO: tcServer Runtime property decoder has been initialized in 206 ms 
Mar 30, 2012 3:35:52 PM org.apache.coyote.AbstractProtocol init 
INFO: Initializing ProtocolHandler ["http-bio-8080"] 
Mar 30, 2012 3:35:52 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init 
INFO: Started up JMX registry on 127.0.0.1:6969 in 65 ms 
Mar 30, 2012 3:35:52 PM org.apache.catalina.startup.Catalina load 
INFO: Initialization processed in 741 ms 
Mar 30, 2012 3:35:52 PM org.apache.catalina.core.StandardService startInternal 
INFO: Starting service Catalina 
Mar 30, 2012 3:35:52 PM org.apache.catalina.core.StandardEngine startInternal 
INFO: Starting Servlet Engine: VMware vFabric tc Runtime 2.6.3.RELEASE/7.0.23.A.RELEASE 
Mar 30, 2012 3:35:52 PM org.apache.catalina.startup.HostConfig deployDescriptor 
INFO: Deploying configuration descriptor C:\Users\me\Documents\workspace-sts-2.9.0.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\Catalina\localhost\trainingdividend.xml 
Mar 30, 2012 3:35:52 PM org.apache.catalina.startup.SetContextPropertiesRule begin 
WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:trainingdividend' did not find a matching property. 
Mar 30, 2012 3:35:52 PM org.apache.catalina.startup.HostConfig deployWAR 
INFO: Deploying web application archive C:\Users\me\Documents\workspace-sts-2.9.0.RELEASE\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\insight.war 
Mar 30, 2012 3:35:52 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start 
INFO: Context [localhost|insight] will not be woven 
Mar 30, 2012 3:35:53 PM org.apache.catalina.core.ApplicationContext log 
INFO: Initializing Spring root WebApplicationContext 
Mar 30, 2012 3:36:03 PM org.apache.catalina.core.ApplicationContext log 
INFO: Initializing Spring FrameworkServlet 'Spring MVC Dispatcher Servlet' 
Mar 30, 2012 3:36:05 PM org.apache.coyote.AbstractProtocol start 
INFO: Starting ProtocolHandler ["http-bio-8080"] 
Mar 30, 2012 3:36:05 PM org.apache.catalina.startup.Catalina start 
INFO: Server startup in 13468 ms 
+1

您看不到運行方式>在服務器上運行? – bvulaj 2012-03-30 18:11:18

+0

我之前沒有看到該選項,但我現在看到它。我必須首先將Web模塊方面添加到項目中。現在我已經完成了,那個選項終於出現了。奇怪的是,maven eclipse:eclipse的目標並沒有爲我自動完成。現在,當我運行服務器時,它仍然沒有選擇它。我得到一個404錯誤:/我想知道什麼是錯的。在IDEA中這樣做很容易:/ – 2012-03-30 18:48:58

回答

2

如果你缺少的運行方式>在服務器選項來運行,那麼很有可能你的項目沒有動態Web模塊方面。

+0

是的,這是部分正確的。謝謝。我現在有選擇,但我認爲它仍然沒有正確加載它。我將粘貼tc服務器的輸出 – 2012-03-30 18:51:47

+0

您可以嘗試使用m2e插件而不是使用mvn eclipse:eclipse並查看它是否能更好地創建項目。我假設您的POM中指定的包裝是戰爭。 – digitaljoel 2012-03-30 19:09:12

+0

是的,這似乎是一個明智的做法。我第一次試圖「導入」這個項目 - 並沒有像我預期的那樣工作。然後我嘗試了maven的目標,並且這對大部分事情都有效。我會嘗試下一次,因爲應用程序沒有在服務器上運行 - 它只是忽略它。我不知道爲什麼。 – 2012-03-30 19:12:43

0

我在使用Dynamic WebModules創建的J2ee項目中遇到404錯誤。起初我認爲這是一個上下文問題,因爲STS試圖運行的URL是非常錯誤的。然而該項目的背景是正確的。但在我取得任何進展之前,需要擺脫標記選項卡中顯示的錯誤(這可能不會停止嘗試以服務器方式運行)。

解決了明顯的代碼,jar,路徑錯誤後,我再檢查一下是否可以正確導出war文件。如果不是這樣,它通常是項目屬性的部署彙編部分中的一個問題(至少在我的Java項目中)。需要從需要的項目中指定類文件和jar以獲取正確的war文件結構。一旦完成,再見404s

相關問題