This exception bugged me quite a lot.
Here are some solutions, one of them might work for you.
1. If you have <annotation-driven /> in you servlet and you are trying to implement any interfaces in your controller or trying to use any non-annotated controller. You need to add below code in your servlet.
<beans:bean id="simpleHandler" class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>
(the handler adapters are different for annotated and non-annotated controllers.)
2. you might need to change <annotation-driven /> to <tx:annotation-driven proxy-target-class="false"/>
for this add below namespaces in your servlet
xmlns:tx="http://www.springframework.org/schema/tx"
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
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
3. If your controller is annotated controller and you are still getting this exception, you need to make sure that one of the methods in your controller must have
@RequestMapping(value = "/", method = RequestMethod.GET)
Hope this would be helpful to some folks.
Here are some solutions, one of them might work for you.
1. If you have <annotation-driven /> in you servlet and you are trying to implement any interfaces in your controller or trying to use any non-annotated controller. You need to add below code in your servlet.
<beans:bean id="simpleHandler" class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>
(the handler adapters are different for annotated and non-annotated controllers.)
2. you might need to change <annotation-driven /> to <tx:annotation-driven proxy-target-class="false"/>
for this add below namespaces in your servlet
xmlns:tx="http://www.springframework.org/schema/tx"
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
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
3. If your controller is annotated controller and you are still getting this exception, you need to make sure that one of the methods in your controller must have
@RequestMapping(value = "/", method = RequestMethod.GET)
Hope this would be helpful to some folks.
you might also need to check if you implement SimpleFormController from mvc or portlet package. I spend half a day because my IDE added portlet version in my imports.
ReplyDeleteThis saved me days of headache. Thanks. Really.
Delete