Results 1 to 6 of 6

Thread: viewResolver - ERROR: No mapping found for HTTP request with URI

  1. #1
    Join Date
    Jul 2011
    Posts
    8

    Default viewResolver - ERROR: No mapping found for HTTP request with URI

    Hello

    I've this error in TOMCAT server:

    11-ago-2011 19:45:34 org.springframework.web.servlet.DispatcherServlet noHandlerFound
    ADVERTENCIA: No mapping found for HTTP request with URI [/AppSpringJ2EE/WEB-INF/src/views/index.jsp] in DispatcherServlet with name 'AppSpring'


    But I don't know because this error, this is my configuration:

    DispatcherServlet Config file:

    Code:
    ...
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
                <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property>
                <property name="prefix" value="/WEB-INF/src/views/"></property>
                <property name="suffix" value=".jsp"></property>
        </bean>
    ...
    Too I've config <context:component-scan ... >, <mvc:annotation-driven/> and <context:annotation-config/> for use the anotations @Autowired, @RequestMapping, @Component ... in container aplication

    And the return view form the controllers mapping:
    Code:
    ...
    return new ModelAndView("sesion", modelMap);
    ...
    When I request to server, I receive the response -> No mapping found for HTTP request with URI [/AppSpringJ2EE/WEB-INF/src/views/index.jsp] in DispatcherServlet with name 'AppSpring', but the view files JSP are in this directory.

    Thank you, See you soon. Excuse my English level.

  2. #2
    Join Date
    Apr 2006
    Posts
    166

    Default

    Hello

    There are many reasons for this error. You may see a similar thread here http://www.coderanch.com/t/485589/Sp...gframework-web
    You should look at web.xml, your config file. In addition, your method does not need return "new ModelAndView", it can return a String (the name of the view) in controller mapping

  3. #3
    Join Date
    Jul 2011
    Posts
    8

    Default

    Thanks!!

    But, I haven't the same error.

    AppSpringJ2EE.zip
    I go to attach the files involved in the project.

    Diagnosis:
    1) the <url-pattern>/*</url-pattern> in servletMapping on web.xml is ok, and the DispacherServlet is create, the controller bean is create too, and I can debug on my controllers mapping in java classes
    2) the deploy in tomcat's directory have all the files (classes, jsp, libs, xml configs ...)
    3) the config to viewResolver is work ok, prefix and suffix is concat ok
    4) when the controller do return, spring don't find the jsp file. I've tried return only the String (the name of the view), but I've the same error.

    I don't know what happen. Thank you.

  4. #4
    Join Date
    Jul 2011
    Posts
    8

    Default

    Sorry, I don't attach the controller java file.

    I upload the file in txt extension.
    Attached Files Attached Files

  5. #5
    Join Date
    Apr 2006
    Posts
    166

    Default

    Try this

    1. Create a context file with name sesion.xml and put in Catalina/localhost/ (tomcat5x). Similar if you have other Tomcats

    <Context path="/sesion" docBase="path to WEB-INF" >
    </Context>

    In web.xml
    2. change from <url-pattern>/*</url-pattern> to <url-pattern>/</url-pattern> (remove *)

    in Controller:
    3. change from @RequestMapping(value = "/sesion/**") to @RequestMapping(value = "/*")
    4. change from @RequestMapping(value = "/sesion/index") to @RequestMapping(value = "index")
    5. change from @RequestMapping(value = "/sesion/connect") to @RequestMapping(value = "connect")
    6. change from @RequestMapping(value = "/sesion/disconnect") to @RequestMapping(value = "disconnect")

    Now enter http://[localhost]:8080/sesion/index

  6. #6
    Join Date
    Jul 2011
    Posts
    8

    Default

    Thank you shoa!!

    I changed url-pattern in web.xml to "/". And It's work.

    Too, I changed the permission on /Tomcat_Directory/work. Because the user whose run Eclipse can't create temp directory. But it's another problem.

    Thanks, see you soon.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •