2012-03-30 61 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