Announcement Announcement Module
No announcement yet.
annotation mapping config Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • annotation mapping config

    Dear All,

    Here is my controller annotation

    public class ManageSomethingFormController {


    Error Message: WARN org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/MTS_TEST/] in DispatcherServlet with name 'dispatcher'.

    It will work if I add the mapping in the servlet.xml
    <property name="mappings">
    <value> </value>

    I thought the whole point of annotation controller is to get rid of the XML mapping including the url mapping completely.Could anyone help me figure out what I missed? Thank very much in advance.

    Here are the config in dispatcher-servlet.xml and web.xml.



    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns=" xmlns:xsi=""
    xmlns:tx="" xmlns:context=""


    <context:component-scan base-package="where/controller/are" />


    <servlet-class>org.springframework.web.servlet.DispatcherSe rvlet</servlet-class>
    <!-- Location of web application configuration for Spring -->

    <!-- Route all URLs ending in .do to the dispatcher servlet -->

  • #2
    I tried to register these two beans in servlet.xml because there are many exsiting controllers are not annotated and still using SimpleUrlHandlerMapping in the servlet.xml for the url mapping.

    <bean class="org.springframework.web.servlet.mvc.annotat ion. DefaultAnnotationHandlerMapping" />

    <bean class="org.springframework.web.servlet.mvc.annotat ion. AnnotationMethodHandlerAdapter" />

    After adding the two beans, all existing non-anotated controllers stopped working. Here is the error messages.

    ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/TEST].[dispatcher] - Servlet.service() for servlet dispatcher threw exception
    javax.servlet.ServletException: No adapter for handler [ troller@5d626b]: Does your handler implement a supported interface like Controller?
    Last edited by 7of9; Dec 23rd, 2010, 03:43 AM.


    • #3
      problem solved by myself. remove the AnnotationMethodHandlerAdapter, but leave the DefaultAnnotationHandlerMapping in