Note that there are some explanatory texts on larger screens.

plurals
  1. POSpring MVC - WARN [PageNotFound] No mapping found for HTTP request with URI [/foo/bar/baz/rest] in DispatcherServlet with name 'spring-rest'
    primarykey
    data
    text
    <p>I am running Spring MVC on JBoss app server.</p> <p>File: jboss-web.xml :</p> <pre><code> &lt;jboss-web&gt; &lt;context-root&gt;/foo/bar/baz&lt;/context-root&gt; &lt;/jboss-web&gt; </code></pre> <p>Context root is defined as /foo/bar/baz something I can't change.</p> <p>File: web.xml:</p> <pre><code>&lt;servlet&gt; &lt;servlet-name&gt;spring-rest&lt;/servlet-name&gt; &lt;servlet-class&gt;org.springframework.web.servlet.DispatcherServlet&lt;/servlet-class&gt; &lt;load-on-startup&gt;3&lt;/load-on-startup&gt; &lt;/servlet&gt; &lt;servlet-mapping&gt; &lt;servlet-name&gt;spring-rest&lt;/servlet-name&gt; &lt;url-pattern&gt;/&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; </code></pre> <p>It has the dispatcher servlet mapped to url "/"</p> <p>Java: (Controller)</p> <pre><code>@RequestMapping(value="/rest/*", method = RequestMethod.POST) @ResponseBody public SomeResponse processRequest(@RequestBody SomeRequest someRequest) { return someResponse; } </code></pre> <p>I am trying to process the request in this method.</p> <p>When Spring gets loaded in JBoss, I see the following: [</p> <pre><code>DefaultAnnotationHandlerMapping] Mapped URL path [/rest/*] onto handler 'MyController' [DefaultAnnotationHandlerMapping] Mapped URL path [/rest/*.*] onto handler 'MyController' [DefaultAnnotationHandlerMapping] Mapped URL path [/rest/*/] onto handler 'MyController </code></pre> <p>'</p> <p>I try to access: <a href="http://localhost:8080/foo/bar/baz/rest" rel="nofollow">http://localhost:8080/foo/bar/baz/rest</a>, what I see is:</p> <p>WARN [PageNotFound] No mapping found for HTTP request with URI [/foo/bar/baz/rest] in DispatcherServlet with name 'spring-rest'</p> <p>But when I change value to "/<em>" from "/rest/</em>" in Java as :</p> <pre><code>@RequestMapping(value="/*", method = RequestMethod.POST) </code></pre> <p>It then works fine.How do I fix the problem?</p> <p>spring-rest-servlet.xml:</p> <pre><code>&lt;bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"&gt; &lt;property name="alwaysUseFullPath" value="true"/&gt; &lt;/bean&gt; &lt;bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"&gt; &lt;property name="alwaysUseFullPath" value = "true" /&gt; &lt;/bean&gt; </code></pre>
    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