I'm having this issue with Spring MVC on Tomcat that causes the server to return Tomcat's 405 error after the controller method executes.
Web.xml
My controller usesCode:<!-- Spring security configuration --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext-security.xml</param-value> </context-param> <filter> <filter-name>springSecurityFilterChain</filter-name> <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class> </filter> <filter-mapping> <filter-name>springSecurityFilterChain</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <!-- Spring MVC app --> <servlet> <servlet-name>client</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <init-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/client/client-servlet.xml</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>client</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>Code:@RequestMapping(value = {"", "/*"}, method = RequestMethod.GET)When i visit mydomain.com or mydomain.com/ - I get the Tomcat 405 GET not supported error. If I put anything in the trailing path it loads the page just fine. (e.g. mydomain.com/a)Code:@RequestMapping(value = {"", "/*"}, method = RequestMethod.GET) public String home(Model model) { retrieveOffers(model); logger.warning("Loading home page"); return "main"; }
The interesting thing is that I always see the "Loading home page" log statement and from my logs there is no difference between requests. It just seems like Tomcat is intercepting the response sometime between the controller finishing and the view rendering. Any thoughts?


Reply With Quote
