Note that there are some explanatory texts on larger screens.

plurals
  1. POnoHandlerFound No mapping found for HTTP request with URI [..]
    primarykey
    data
    text
    <p>I am trying out a very simple helloworld kind RestFul webservice in the Spring environment and I have been getting "org.springframework.web.servlet.DispatcherServlet noHandlerFound No mapping found for HTTP request with URI [..] in DispatcherServlet with name ..". I have tried various things but nothing is working. So far this is what I have :</p> <p>web.xml</p> <pre><code>&lt;listener&gt; &lt;listener-class&gt;org.springframework.web.context.ContextLoaderListener&lt;/listener-class&gt; &lt;/listener&gt; &lt;servlet&gt; &lt;servlet-name&gt;spitter&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;1&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;spitter&lt;/servlet-name&gt; &lt;url-pattern&gt;/testWs/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; &lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt;/WEB-INF/spitter-servlet.xml&lt;/param-value&gt; &lt;/context-param&gt; </code></pre> <p>spitter-servlet.xml</p> <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" 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"&gt; &lt;mvc:annotation-driven /&gt; &lt;context:component-scan base-package="org.resttest.bso" /&gt; &lt;bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt; &lt;property name="prefix" value="/WEB-INF/views/" /&gt; &lt;property name="suffix" value=".jsp" /&gt; &lt;/bean&gt; &lt;/beans&gt; </code></pre> <p>And the Controller class;</p> <pre><code>package org.resttest.bso; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.ui.ModelMap; @Controller @RequestMapping("/partners") public class PartnerController { public PartnerController(){ System.out.println("******* From the constructor ***** " ); } @RequestMapping("method=RequestMethod.GET") public String getPartner(ModelMap model){ try{ model.addAttribute("message", "Spring 3 MVC Hello World"); System.out.println("******* Test message " ); }catch(Exception ex){ System.out.println("******* Exception thrown ... " + ex.getMessage()); } return "test"; } } </code></pre> <p>And in WEB-INF/views/test.jsp</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"&gt;&lt;%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Message : ${message}&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When the server starts I also do see this : [11/28/12 9:24:02:803 EST] 00000013 DefaultAnnota I org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler Mapped URL path [/partners/method=RequestMethod.GET] onto handler 'partnerController'</p> <p>But when I try to access using url : localhost:9080/contextRoot/testWs/partners/ I get the error : [11/28/12 9:31:07:034 EST] 00000044 PageNotFound W org.springframework.web.servlet.DispatcherServlet noHandlerFound No mapping found for HTTP request with URI [/contextRoot/testWs/partners/] in DispatcherServlet with name 'spitter'</p> <p>Any help is highly appreciated. I have tried several changes based on suggestions on the forums, but nothing seems to work.</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload