Spring no adapter for Handler exception

Source: Internet
Author: User

In the spring MVC framework, when using the @ controller annotation to implement controller and other different types of controllers (such as controllers inherited from the Controller), you usually need to configure the adapter.

1. When using and inheriting simpleformcontroller as the controller (public class logincontroller extends simpleformcontroller), you need to configure

<Bean class = "org. springframework. Web. servlet. MVC. simplecontrollerhandleradapter"/> otherwise, an exception similar to the following occurs:

javax.servlet.ServletException: No adapter for handler [com.test.spring.mvc.contoller.LoginController@c6e1ec]: Does your handler implement a supported interface like Controller?org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:982)org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:770)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)javax.servlet.http.HttpServlet.service(HttpServlet.java:621)javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

2. When using the HTTP service provided by httpinvokerserviceexporter, you must configure it in the-servlet. xml file.

<Bean class = "org. springframework. Web. servlet. MVC. httprequesthandleradapter"/> otherwise, an exception similar to the following occurs:

javax.servlet.ServletException: No adapter for handler [org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter@45378f]: Does your handler implement a supported interface like Controller?org.springframework.web.servlet.DispatcherServlet.getHandlerAdapter(DispatcherServlet.java:982)org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:770)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)javax.servlet.http.HttpServlet.service(HttpServlet.java:621)javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.