Announcement Announcement Module
Collapse
No announcement yet.
Spring 3.0 MVC Template - Page Not found Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring 3.0 MVC Template - Page Not found

    Hello,

    I'm new to Spring, so this might be a simple question. I'm trying to create a Spring 3.0 MVC app using the sts-2.8.1.RELEASE. I'm basing it on this tutorial:

    http://blog.springsource.org/2011/01...th-spring-mvc/

    I've followed all the steps, but the result is always a 404 page not found, (except for once, where it successfully created a web app, but I can't repeat it). It also shows this error message:

    org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/mytest/] in DispatcherServlet with name 'appServlet'

    Is there a workaround for this? I just want to be sure I can create multiple Spring MVC apps.

  • #2
    Possible to copy or generate with Maven?

    As additional information, I've been able to get the one working MVC project to read and display input parameters on a JSP page per the tutorial.

    Since I have a working version, and since I haven't had any luck creating another version via the template, would it be possible to somehow copy and rename the project? I tried that, but missed a name change somewhere and ended up with duplicates in the server.

    Another option would be to use the pom.xml that's given in the tutorial to generate a war file, but I'm having a tough time locating where the server directory is to copy the war file into.

    It would also be nice if someone could point out where the server log is, which I've been unable to locate.

    A third option would be to create a spring MVC project without using the template. That would be fine as well, if someone could just point me to a resource to get me started on that.

    Comment


    • #3
      Hey!

      What kind of problems do you have with the template project? It should work mostly out-of-the-box. Sometimes there are some weird errors showing up, but they typically disappear after a project clean. So what is not working on your case when you create a template project using the web mvc template?

      Cheers,
      -Martin

      Comment


      • #4
        Originally posted by Martin Lippert View Post
        Hey!

        What kind of problems do you have with the template project? It should work mostly out-of-the-box. Sometimes there are some weird errors showing up, but they typically disappear after a project clean. So what is not working on your case when you create a template project using the web mvc template?

        Cheers,
        -Martin
        Hi Martin,

        Thanks for the reply. I mentioned the error that I was getting in the original post:

        "org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/mytest/] in DispatcherServlet with name 'appServlet'"

        However, with your suggestion of doing a clean, they all now work. Thanks!

        Comment


        • #5
          Hey!

          Glad to hear its working now, after the project clean!

          Cheers,
          -Martin

          Comment


          • #6
            MVC Template - Similar problem but clean not working

            I Get the initial JSTL Error I think the previous poster was getting, a clean fixes that, but then I have other errors.

            I created new project based on spring mvc template with latest STS download as of 1/31/2012:
            Version: 2.8.1.RELEASE
            Build Id: 201111221000

            Using jdk: 1.6.0_30-b12 on Win7 32bit.

            Eclipse is complaining with two errors on:
            root-context.xml
            servlet-context.xml

            Saying unable to load schema mappings from META-INF/spring.schemas

            When running the app I get:
            Jan 31, 2012 11:27:49 PM org.apache.catalina.startup.TldConfig tldScanJar
            SEVERE: Exception processing TLD META-INF/spring-form.tld in JAR at resource path C:\Dev\Workspace\.metadata\.plugins\org.eclipse.ws t.server.core\tmp0\wtpwebapps\SpringMVC1\WEB-INF\lib\spring-webmvc-3.0.6.RELEASE.jar in context /SpringMVC1
            java.util.zip.ZipException: invalid LOC header (bad signature)
            at java.util.zip.ZipFile.read(Native Method)

            Which results in
            Jan 31, 2012 11:27:49 PM org.apache.catalina.core.StandardContext listenerStart
            SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListe ner
            java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextException
            at java.lang.Class.getDeclaredConstructors0(Native Method)


            I can recreate this every time I delete and create a new project using the Spring MVC Template.

            Any help?

            Comment


            • #7
              Hi!

              The error looks like the spring-webmvc-3.0.6.RELEASE.zip file corrupted: java.util.zip.ZipException: invalid LOC header (bad signature). If you are using Maven, I would wipe out your local Maven repository and let Maven download the ZIPs again.

              HTH,
              Martin

              Comment


              • #8
                Great Thanks! I've been doing things fairly manually in the past and haven't been through inner workings of maven. Found the repository on ~USERHOME/.m2/repository, deleted the whole directory, restarted STS, right click on project and Maven-> Refresh Dependencies. Works now.

                I saw it was issue w/ jar file but had not clue how STS was referencing this file or from where as the directory structure for STS and project settings is not all that clear. Mentioning Maven repository did it for me.

                Thanks!

                Comment


                • #9
                  Glad I could help!

                  Cheers,
                  -Martin

                  Comment

                  Working...
                  X