Announcement Announcement Module
Collapse
No announcement yet.
MVC Project Template Troubles 2.9.1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • MVC Project Template Troubles 2.9.1

    Hi,

    After several years of using NetBeans, I'm giving Spring Tool Suite a try. Things got off to a pretty good start:
    - Downloaded and extracted spring-framework-3.1.1.RELEASE-with-docs.zip.
    - Created a project (miketest) as a Spring Template Project - Spring MVC Project. All of the expected files appear to have been created.
    After the above, there are issues:

    1. In the HomeController.java file, none of the org.springframework imports can be resolved. Changing org.springframework-version in pom.xml from 3.1.0-RELEASE to 3.1.1-RELEASE and doing Project Build fixes this.

    2. The files src/main/webapp/WEB-INF/spring/root-context.xml and src/main/webapp/WEB-INF/spring/appServlet/servlet.context files as initially created have errors. This seems to be fixed by doing a Clean and then a Build.

    3. The tcServer can be started up without anything but INFO messages being logged. (No issue here.)

    4. After adding the project to tcServer, restarting tcServer fails. The log is shown below. I've spent quite a lot of time trying to figure this out, and could use some ideas. Thanks in advance.

    Apr 25, 2012 10:45:10 AM com.springsource.tcserver.security.PropertyDecoder <init>
    INFO: tc Runtime property decoder using memory-based key
    Apr 25, 2012 10:45:10 AM com.springsource.tcserver.security.PropertyDecoder <init>
    INFO: tcServer Runtime property decoder has been initialized in 236 ms
    Apr 25, 2012 10:45:11 AM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-bio-8080"]
    Apr 25, 2012 10:45:11 AM com.springsource.tcserver.serviceability.rmi.JmxSo cketListener init
    INFO: Started up JMX registry on 127.0.0.1:6969 in 77 ms
    Apr 25, 2012 10:45:11 AM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 864 ms
    Apr 25, 2012 10:45:11 AM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Apr 25, 2012 10:45:11 AM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: VMware vFabric tc Runtime 2.6.4.RELEASE/7.0.25.B.RELEASE
    Apr 25, 2012 10:45:11 AM org.apache.catalina.startup.HostConfig deployDescriptor
    INFO: Deploying configuration descriptor C:\CQS Platform\springsource\vfabric-tc-server-developer-2.6.4.RELEASE\spring-insight-instance\conf\Catalina\localhost\insight.xml
    Apr 25, 2012 10:45:11 AM com.springsource.insight.collection.tcserver.ltw.T omcatWeavingInsightClassLoader start
    INFO: Context [localhost|insight] will not be woven
    Apr 25, 2012 10:45:12 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring root WebApplicationContext
    Apr 25, 2012 10:45:22 AM org.apache.catalina.core.ApplicationContext log
    INFO: Initializing Spring FrameworkServlet 'Spring MVC Dispatcher Servlet'
    Apr 25, 2012 10:45:25 AM org.apache.catalina.startup.HostConfig deployDescriptor
    INFO: Deploying configuration descriptor C:\CQS Platform\springsource\vfabric-tc-server-developer-2.6.4.RELEASE\spring-insight-instance\conf\Catalina\localhost\miketest.xml
    Apr 25, 2012 10:45:25 AM org.apache.catalina.startup.SetContextPropertiesRu le begin
    WARNING: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:miketest' did not find a matching property.
    Apr 25, 2012 10:45:25 AM com.springsource.insight.collection.tcserver.ltw.T omcatWeavingInsightClassLoader start
    INFO: Context [localhost|miketest] will not be woven
    Apr 25, 2012 10:45:25 AM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
    java.lang.NoClassDefFoundError: org/apache/log4j/Level
    at org.slf4j.LoggerFactory.getSingleton(LoggerFactory .java:230)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:12 1)
    at org.slf4j.LoggerFactory.performInitialization(Logg erFactory.java:112)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFa ctory.java:275)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.ja va:248)
    at org.apache.commons.logging.impl.SLF4JLogFactory.ge tInstance(SLF4JLogFactory.java:155)
    at org.apache.commons.logging.impl.SLF4JLogFactory.ge tInstance(SLF4JLogFactory.java:131)
    at org.apache.commons.logging.LogFactory.getLog(LogFa ctory.java:272)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:270)
    at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 111)
    at org.apache.catalina.core.StandardContext.listenerS tart(StandardContext.java:4779)
    at org.apache.catalina.core.StandardContext.startInte rnal(StandardContext.java:5273)
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:897)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:873)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployDescr iptor(HostConfig.java:649)
    at org.apache.catalina.startup.HostConfig$DeployDescr iptor.run(HostConfig.java:1581)
    at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a: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:722)
    Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1701)
    at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1546)
    ... 24 more

    Apr 25, 2012 10:45:25 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Apr 25, 2012 10:45:25 AM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/miketest] startup failed due to previous errors
    Apr 25, 2012 10:45:25 AM org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    Apr 25, 2012 10:45:25 AM org.apache.catalina.core.StandardContext listenerStop
    SEVERE: Exception sending context destroyed event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
    java.lang.ExceptionInInitializerError
    at org.springframework.web.context.ContextLoaderListe ner.contextDestroyed(ContextLoaderListener.java:14 4)
    at org.apache.catalina.core.StandardContext.listenerS top(StandardContext.java:4819)
    at org.apache.catalina.core.StandardContext.stopInter nal(StandardContext.java:5466)
    at org.apache.catalina.util.LifecycleBase.stop(Lifecy cleBase.java:232)
    at org.apache.catalina.util.LifecycleBase.start(Lifec ycleBase.java:160)
    at org.apache.catalina.core.ContainerBase.addChildInt ernal(ContainerBase.java:897)
    at org.apache.catalina.core.ContainerBase.addChild(Co ntainerBase.java:873)
    at org.apache.catalina.core.StandardHost.addChild(Sta ndardHost.java:615)
    at org.apache.catalina.startup.HostConfig.deployDescr iptor(HostConfig.java:649)
    at org.apache.catalina.startup.HostConfig$DeployDescr iptor.run(HostConfig.java:1581)
    at java.util.concurrent.Executors$RunnableAdapter.cal l(Executors.java:471)
    at java.util.concurrent.FutureTask$Sync.innerRun(Futu reTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.jav a: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:722)
    Caused by: java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized. See also http://www.slf4j.org/codes.html#unsuccessfulInit
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFa ctory.java:282)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.ja va:248)
    at org.apache.commons.logging.impl.SLF4JLogFactory.ge tInstance(SLF4JLogFactory.java:155)
    at org.apache.commons.logging.impl.SLF4JLogFactory.ge tInstance(SLF4JLogFactory.java:131)
    at org.apache.commons.logging.LogFactory.getLog(LogFa ctory.java:272)
    at org.springframework.web.context.ContextCleanupList ener.<clinit>(ContextCleanupListener.java:43)
    ... 16 more

    Apr 25, 2012 10:45:25 AM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory C:\CQS Platform\springsource\vfabric-tc-server-developer-2.6.4.RELEASE\spring-insight-instance\webapps\manager
    Apr 25, 2012 10:45:25 AM com.springsource.insight.collection.tcserver.ltw.T omcatWeavingInsightClassLoader start
    INFO: Context [localhost|manager] will not be woven
    Apr 25, 2012 10:45:25 AM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory C:\CQS Platform\springsource\vfabric-tc-server-developer-2.6.4.RELEASE\spring-insight-instance\webapps\ROOT
    Apr 25, 2012 10:45:25 AM com.springsource.insight.collection.tcserver.ltw.T omcatWeavingInsightClassLoader start
    INFO: Context [localhost|ROOT] will not be woven
    Apr 25, 2012 10:45:25 AM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-bio-8080"]
    Apr 25, 2012 10:45:25 AM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 14536 ms

  • #2
    Hey!

    Are you using the STS distribution from http://www.springsource.com/developer/sts or did you install STS as plugin into an existing Eclipse installation? I am asking because the MVC template project is based on Maven and your descriptions sound like the Maven Eclipse Integration is not installed or doesn't work. Can you check this? The easiest way is for sure to download the STS distribution, which comes with all those components being already installed.

    If that is not the problem, can you expand the "Maven Dependencies" node in your package explorer to see what libraries the Maven integration added to the project?

    HTH,
    Martin

    Comment


    • #3
      Martin, thanks for you response.

      I'm using the full STS distribution, downloaded as springsource-tool-suite-2.9.1.RELEASE-e3.7.2-win32-x86_64-installer. The reference to spring-framework-3.1.1.RELEASE-with-docs.zip in the earlier posting was misleading.

      Starting at square one with a new Spring Template Project - Spring MVC Project (test2), I get the attached log (tcServerLog.txt) when attempting to start tcServer. The attached jpg shows the Maven Dependencies that were created from the template. For what its worth, I'm running under Windows 7, 64-bit.

      ------------------------------

      On my original project (miketest), which I changed to Spring 3.1.1 (instead of 3.1.0 as created by the template), I've made some progress. After switching to logback 1.0.1 and slf4j 1.6.4 (instead of log4j 1.2.15 and slf4j 1.5.10), tcServer is starting up nicely, finding a simple logback.xml and logging as expected. Still stuck though, as Open Home Page results in a 404 error and the log message:

      8177 [tomcat-http--3] WARN org.springframework.web.servlet.DispatcherServlet - No mapping found for HTTP request with URI [/miketest/] in DispatcherServlet with name 'appServlet'

      Maybe there is something else that needs to be configured, or perhaps the template generated home.jsp or HomeController.java needs a tweak. Since I'm new to Spring and Spring MVC, it could be something pretty obvious that I'm not seeing, although poking around on the web for ideas hasn't turned anything up.

      The complete log is in the tcServerLog_miketest.txt attachment.

      Thanks.

      Mike

      Comment


      • #4
        Hey Mik!

        Good to know that you are using the full distribution. In general, the template projects should work out-of-the-box. Due to some strange reason you sometimes need to do a clean build of the project after it got created in order to deploy it correctly to tc Server. Can you try that? Just start STS with a fresh workspace, create a project from the MVC template, wait a bit until the IDE tells you nothing is going on anymore, and then do a clean build (Project menu -> Clean...). After that, drag & drop the project onto the tc Server instance that you see in the Servers view and start the server. This should work (and it does for me).

        HTH,
        Martin

        Comment

        Working...
        X