1

我正在尝试使用 SpringSource Tool Suite 了解 Spring。在这个阶段,我没有太多成功的经验。

到目前为止,我已经能够安装 STS 并创建一个新项目,但还没有走得更远。在 tc 服务器上运行应用程序时似乎会出现此问题。我将完成我已采取的步骤,也许有人可以指出我哪里出错了。作为记录,我使用的是 Ubuntu 11.10。

  • 我使用此链接安装了 STS,该链接是在 SpringSource Tool Suite 下载页面上找到的。
  • 在安装 STS 期间,我选择安装在我的主文件夹 /home/luke/springsource 中。我选择了所有包:SpringSource Tool Suite 2.8.0.RELEASE;vFabric tc 服务器 2.6.1.RELEASE;Spring Roo 1.1.5.RELEASE;阿帕奇 Maven 3.0.3
  • 在选择JDK路径时,我选择了/usr/lib/jvm/default-java,它链接到/usr/lib/jvm/java-6-openjdk。
  • 安装成功完成,我通过转到安装目录 /home/luke/springsource/sts-2.8.0.RELEASE 并执行文件 STS 手动启动 STS。尽管在安装结束时选中了现在运行 STS 的复选框,但我必须这样做才能运行 STS(不确定这是否是一个真正的问题,但认为值得一提)。
  • 我选择我的工作区 /home/luke/Documents/workspace-sts-2.8.0.RELEASE 并单击确定。到目前为止,一切都很好?
  • 在仪表板中,我单击 Create > Spring Template Project。
  • 在下面的对话框中,我单击 Spring MVC Project 并单击 Next,然后同意下载。
  • 在 Project Settings 对话框中,我为项目命名,springmvc 和一个有效的顶级包,然后单击 Finish。
  • 我现在可以在 Package Explorer 中看到我新创建的项目,以及 Servers 文件夹,以及 Server 窗口中的 VMware vFabric tc Server Developer Edition v2.6。
  • 我在“服务器”窗口中将项目拖到服务器上,项目以 [Synchronized] 状态出现在那里。然后我在 Package Explorer 中右键单击该项目,然后单击 Run As > Run on Server。前面提到的服务器在那里并被选中,所以我单击下一步。我创建的项目位于下一个屏幕的 Configured 部分,因此我单击 Finish。系统询问我是否要使用 Spring Insight,所以我单击 Yes 并启动服务器。

这是大麻烦开始的地方。

  • 我得到控制台的以下输出和浏览器窗口中的 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 用例,将不胜感激。

4

2 回答 2

4

同上拉尔夫。

选择了顶级项目,去了

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

它正确地通过了。我不确定为什么它首先会失败,或者为什么安装它两次可以修复它。

于 2012-05-11T14:19:54.070 回答
3

看起来项目未正确部署到服务器。服务器的上下文菜单包含一个清理它的选项。清理后使用相同的上下文菜单并发布应用程序。然后再试一次。

(此问题的另一个原因可能是编译器故障。)

于 2011-11-03T09:51:34.643 回答