I am trying to create some restful web services using Spring MVC 3.0. I currently have an issue that only 1 of my 2 controllers will work at any given time. As it turns out, whichever class comes first when sorted alphabetically will work properly. The error I get is:
handleNoSuchRequestHandlingMethod No matching handler method found for servlet request: path '/polinq.xml', method 'GET', parameters map[[empty]]
I had a very simliar message earlier also, except instead of the map being empty it was something like map[v--String(array)]
Regardless of the message though, currently the LocationCovgController works and the PolicyInquiryController doesn't. If I change the change of the PolicyInquiryController to APolicyInquiryController, then it will start funcitoning properly and the LocationCovgController will stop working.
Any assistance would be greatly appreciated.
Thank you very much,
Jeremy
The information provided below includes the skeleton of both controller classes and also the servlet config file that defines how spring should be setup.
Controller 1
package org.example;
@Controller
@RequestMapping(value = "/polinq.*")
public class PolicyInquiryController {
@RequestMapping(value = "/polinq.*?comClientId={comClientId}")
public ModelAndView getAccountSummary(
@PathVariable("comClientId") String commercialClientId) {
// setup of variable as was removed.
ModelAndView mav = new ModelAndView("XmlView",
BindingResult.MODEL_KEY_PREFIX + "accsumm", as);
return mav;
}
}
Controller 2
package org.example;
@Controller
@RequestMapping(value = "/loccovginquiry.*")
public class LocationCovgController {
@RequestMapping(value = "/loccovginquiry.*method={method}")
public ModelAndView locationCovgInquiryByPolicyNo(
@PathVariable("method")String method) {
ModelAndView mav = new ModelAndView("XmlView",
BindingResult.MODEL_KEY_PREFIX + "loccovg", covgs);
return mav;
}
}
Servlet Config
<context:component-scan base-package="org.example." />
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver" p:order="0">
<property name="mediaTypes">
<map>
<entry key="atom" value="application/atom+xml"/>
<entry key="xml" value="application/xml"/>
<entry key="json" value="application/json"/>
<entry key="html" value="text/html"/>
</map>
</property>
<property name="defaultContentType" value="text/html"/>
<property name="ignoreAcceptHeader" value="true"/>
<property name="favorPathExtension" value="true"/>
<property name="viewResolvers">
<list>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
</list>
</property>
<property name="defaultViews">
<list>
<bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView"/>
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
<bean id="XmlView" class="org.springframework.web.servlet.view.xml.MarshallingView">
<property name="marshaller" ref="marshaller"/>
</bean>
<oxm:jaxb2-marshaller id="marshaller">
<oxm:class-to-be-bound name="org.example.policy.dto.AccountSummary"/>
<oxm:class-to-be-bound name="org.example.policy.dto.InsuredName"/>
<oxm:class-to-be-bound name="org.example.policy.dto.Producer"/>
<oxm:class-to-be-bound name="org.example.policy.dto.PropertyLocCoverage"/>
<oxm:class-to-be-bound name="org.example.policy.dto.PropertyLocCoverages"/>
</oxm:jaxb2-marshaller>