Strange behavior of @RequestMapping on a maven war overlay
I've some strange issues with @RequestMapping behavior. Here is the scenario
I have a web project with a @Controller class and some @RequestMapping
methods. They work fine. One mapping is, for example,
@RequestMapping("/jpm/{param}/add")
I have another web project with a war overlay on the first project. Every
thing works fine, I inherite the controller and it methods. No problem so
far.
Now I want a new @Controller in the 2nd project. I add it just like the
other one but with a diferent @RequestMapping ("/jpm/{param}/activate")
method.
@Controller and @RequestMapping are readed fine by Spring as I can see
them in logs but, while "/jpm/{param}/add" works, "/jpm/{param}/activate"
does not, it says 404 resource not found.
Both classes are in different packages but both are loaded, I have two
context:component-scan, one on each project. I've find that if both
classes are in the same package (name), they work fine (even in diferents
projects).
Is that normal? What I'm missing? Why the controller and mapping get
readed but just doesn't work?
I'm getting mad with this, any advice is welcome!.
web.xml (on 1st project)
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
WEB-INF/applicationContext.xml,
WEB-INF/spring-locale.xml,
WEB-INF/spring-security.xml,
WEB-INF/spring-datasource.xml,
WEB-INF/spring-hibernate.xml,
WEB-INF/spring-jpm.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>
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<servlet>
<servlet-name>jpm</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jpm</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>redirect.jsp</welcome-file>
</welcome-file-list>
No comments:
Post a Comment