Spring REST service "No mapping found for HTTP request with URI"
<p>I'm having a strange issue with my rest server using Spring. I didn't found any solution to my problem in other questions.</p>

<p>Everything works fine, I have multiple mappings to different controller methods and they all work. I made a new mapping to another URI and I can't make it work, I always get the 404 not found error when trying to access it.</p>

<p>Here is some of my code:</p>

<p>Restcontroller:</p>

<pre><code>@RequestMapping(value = "/addToken/{token}/imei/{imei}", method = RequestMethod.POST)
    public boolean setUserToken(@PathVariable("token") String token, @PathVariable("imei") String imei) {
        boolean result = false;
        try {
            result = DbConnector.setToken(imei,token);
        } catch (Exception e) {
            System.out.println("Couldn't set token to database");
        }
        return result;
    }
</code></pre>

<p>This is the method that doesn't work and I don't know why, when I call base_url/addToken I get no error but when I add anything after it I get 404 error.</p>

<p>Web.xml:</p>

<pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"&gt;
 &lt;display-name&gt;SpringServiceSample&lt;/display-name&gt;
 &lt;servlet&gt;
    &lt;servlet-name&gt;rest&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;rest&lt;/servlet-name&gt;
    &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
&lt;/servlet-mapping&gt;
&lt;/web-app&gt;
</code></pre>

<p>rest-servlet.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;beans xmlns="http://www.springframework.org/schema/beans"
 xmlns:context="http://www.springframework.org/schema/context"
 xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:p="http://www.springframework.org/schema/p"
 xsi:schemaLocation="
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc.xsd"&gt;
 &lt;context:component-scan base-package="controllers" /&gt; &lt;!-- Spring auto scans all elements in base package and all its child packages for Controller servlet --&gt;

&lt;!-- &lt;mvc:annotation-driven&gt; --&gt;
&lt;!--      &lt;mvc:message-converters&gt; --&gt;
&lt;!--             &lt;bean class="org.springframework.http.converter.StringHttpMessageConverter"/&gt; --&gt;
&lt;!--             &lt;bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/&gt; --&gt;
&lt;!--    &lt;/mvc:message-converters&gt; --&gt;
&lt;!-- &lt;/mvc:annotation-driven&gt; --&gt;

&lt;mvc:annotation-driven /&gt;
  &lt;/beans&gt;
</code></pre>

<p>Thanks in advance for your help.</p>