Announcement Announcement Module
Collapse
No announcement yet.
STS 2.8.1 Cannot "Open Home Page" for new Spring MVC app, get Status 404 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • STS 2.8.1 Cannot "Open Home Page" for new Spring MVC app, get Status 404

    File - New - Spring Template Project - Spring MVC Project

    project name: mvc1
    top package: org.my.app1 click Finish

    Drag new folder from Package Explorer, drop on vFabric tc Server

    Start server, so far all is good

    In Servers window, expand tcServer, right click the new app mvc1, "Open Home Page"

    It opens this URL:

    http://localhost:8080/mvc1/

    and always shows:

    HTTP Status 404 - The requested resource () is not available.

    VMware vFabric tc Runtime 2.6.1.RELEASE/7.0.20.B.RELEASE

    NOTE: This used to work in STS 271 and earlier, and broke with STS 272 to present

    One cannot proceed to write an app if the "Hello world" page cannot display.

    PS if I open http://localhost:8080/
    it opens properly the tc Server home page.

  • #2
    Hey John,

    same problem here. Something is wrong with the controller- or requestmapping: In my case it does not even pass through the HomeController (no System.out):

    Code:
    @Controller
    public class HomeController {
    	
    	private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
    	
    	/**
    	 * Simply selects the home view to render by returning its name.
    	 */
    	@RequestMapping(value = "/", method = RequestMethod.GET)
    	public String home(Locale locale, Model model) {
    		/*logger.info("Welcome home! the client locale is "+ locale.toString());
    		
    		Date date = new Date();
    		DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG, locale);
    		
    		String formattedDate = dateFormat.format(date);
    		
    		model.addAttribute("serverTime", formattedDate );
    		
    		return "home";*/
    		
    		System.out.println("HomeController: Passing through...");
            return "WEB-INF/views/home.jsp";
    	}
    }
    Console output when starting the server:

    Code:
    Jan 23, 2012 7:23:37 PM com.springsource.tcserver.security.PropertyDecoder <init>
    Information: tc Runtime property decoder using memory-based key
    Jan 23, 2012 7:23:38 PM com.springsource.tcserver.security.PropertyDecoder <init>
    Information: tcServer Runtime property decoder has been initialized in 285 ms
    Jan 23, 2012 7:23:38 PM org.apache.coyote.AbstractProtocol init
    Information: Initializing ProtocolHandler ["http-bio-8080"]
    Jan 23, 2012 7:23:38 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init
    Information: Started up JMX registry on 127.0.0.1:6969 in 79 ms
    Jan 23, 2012 7:23:38 PM org.apache.catalina.startup.Catalina load
    Information: Initialization processed in 1042 ms
    Jan 23, 2012 7:23:39 PM org.apache.catalina.core.StandardService startInternal
    Information: Starting service Catalina
    Jan 23, 2012 7:23:39 PM org.apache.catalina.core.StandardEngine startInternal
    Information: Starting Servlet Engine: VMware vFabric tc Runtime 2.6.1.RELEASE/7.0.20.B.RELEASE
    Jan 23, 2012 7:23:39 PM org.apache.catalina.startup.HostConfig deployDescriptor
    Information: Deploying configuration descriptor gazetteer.xml from C:\Program Files\SpringSource Tool Suite\vfabric-tc-server-developer-2.6.1.RELEASE\spring-insight-instance\conf\Catalina\localhost
    Jan 23, 2012 7:23:39 PM org.apache.catalina.startup.SetContextPropertiesRule begin
    Warnung: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:DAIGazetteer' did not find a matching property.
    Jan 23, 2012 7:23:39 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start
    Information: Context [localhost|gazetteer] will not be woven
    Jan 23, 2012 7:23:39 PM org.apache.catalina.core.ApplicationContext log
    Information: Initializing Spring root WebApplicationContext
    INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
    INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Mon Jan 23 19:23:39 CET 2012]; root of context hierarchy
    INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
    INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@6a757925: defining beans []; root of factory hierarchy
    INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 264 ms
    Jan 23, 2012 7:23:40 PM org.apache.catalina.core.ApplicationContext log
    Information: Initializing Spring FrameworkServlet 'appServlet'
    INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization started
    INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing WebApplicationContext for namespace 'appServlet-servlet': startup date [Mon Jan 23 19:23:40 CET 2012]; parent: Root WebApplicationContext
    INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]
    INFO : org.springframework.context.annotation.ClassPathBeanDefinitionScanner - JSR-330 'javax.inject.Named' annotation found and supported for component scanning
    INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
    INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@419e8639: defining beans [org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0,org.springframework.format.support.FormattingConversionServiceFactoryBean#0,org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter#0,org.springframework.web.servlet.handler.MappedInterceptor#0,org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter,org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0,org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0,org.springframework.web.servlet.view.InternalResourceViewResolver#0,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@6a757925
    Jan 23, 2012 7:23:41 PM org.apache.catalina.startup.HostConfig deployDescriptor
    Information: Deploying configuration descriptor insight.xml from C:\Program Files\SpringSource Tool Suite\vfabric-tc-server-developer-2.6.1.RELEASE\spring-insight-instance\conf\Catalina\localhost
    Jan 23, 2012 7:23:41 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start
    Information: Context [localhost|insight] will not be woven
    INFO : org.springframework.web.servlet.handler.SimpleUrlHandlerMapping - Mapped URL path [/resources/**] onto handler 'org.springframework.web.servlet.resource.ResourceHttpRequestHandler#0'
    INFO : org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'appServlet': initialization completed in 801 ms
    Jan 23, 2012 7:23:41 PM org.apache.catalina.core.ApplicationContext log
    Information: Initializing Spring root WebApplicationContext
    Jan 23, 2012 7:23:55 PM org.apache.catalina.core.ApplicationContext log
    Information: Initializing Spring FrameworkServlet 'Spring MVC Dispatcher Servlet'
    Jan 23, 2012 7:23:58 PM org.apache.catalina.startup.HostConfig deployDirectory
    Information: Deploying web application directory manager
    Jan 23, 2012 7:23:58 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start
    Information: Context [localhost|manager] will not be woven
    Jan 23, 2012 7:23:58 PM org.apache.catalina.startup.HostConfig deployDirectory
    Information: Deploying web application directory ROOT
    Jan 23, 2012 7:23:58 PM com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader start
    Information: Context [localhost|ROOT] will not be woven
    Jan 23, 2012 7:23:58 PM org.apache.coyote.AbstractProtocol start
    Information: Starting ProtocolHandler ["http-bio-8080"]
    Jan 23, 2012 7:23:58 PM org.apache.catalina.startup.Catalina start
    Information: Server startup in 19597 ms
    WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/gazetteer/] in DispatcherServlet with name 'appServlet'
    The last line is caused by trying to open "http://localhost:8080/gazetteer/"...

    root-context.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
    	
    	<!-- Root Context: defines shared resources visible to all other web components -->
    		
    </beans>
    servlet-context.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans:beans xmlns="http://www.springframework.org/schema/mvc"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:beans="http://www.springframework.org/schema/beans"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
    		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    
    	<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
    	
    	<!-- Enables the Spring MVC @Controller programming model -->
    	<annotation-driven />
    
    	<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
    	<resources mapping="/resources/**" location="/resources/" />
    
    	<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
    	<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<beans:property name="prefix" value="/WEB-INF/views/" />
    		<beans:property name="suffix" value=".jsp" />
    	</beans:bean>
    	
    	<context:component-scan base-package="org.dainst.gazetteer" />
    	
    	
    	
    </beans:beans>


    Ideas anyone?

    Comment


    • #3
      All I can add is that I'm brand new to Spring development and STS.

      I have the same problem, and I'm (perhaps naively) befuddled as to why I've got so many issues with this tool (version 2.8.1) right out the gate...

      Hello World basically is broken. JSTL path was wrong and now I'm getting a 404 cannot load resource().

      Really?

      Comment


      • #4
        I have this same issue. Any resolution?

        Comment


        • #5
          You need to do a clean of the project (mvc1) and then deploy to tc Server instance.

          Comment


          • #6
            Hey!

            Usually doing a clean build of the project and then deploy it to tc server solves the problem.

            HTH,
            Martin

            Comment


            • #7
              Cleaning the build worked for me...

              going through and performing the clean straightened things out...

              btw, as someone new to all this, what's the best way to pick up STS?
              seems i generally find things by wandering around so to speak.
              it there a better way to start?

              thanks again!

              Comment


              • #8
                Hey!

                Take a look here:
                http://forum.springsource.org/showth...For-Beginners)

                And maybe wach the webinar here:
                http://www.springsource.com/webinar/...rce-tool-suite

                HTH,
                Martin

                Comment


                • #9
                  Ah short update: I did not find a real solution, just reinstalled everything (a second time) and suddenly it worked. :/

                  Comment

                  Working...
                  X