Struts, Tiles and Unretrievable Mappings
If:
a) You are using Apache Struts and Tiles
b) You have multiple Struts configuration scripts like so:
...
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/conf/struts-default.xml</param-value>
</init-param>
<init-param>
<param-name>config/module1</param-name>
<param-value>/WEB-INF/conf/struts-module1.xml</param-value>
</init-param>
<init-param>
<param-name>config/module2</param-name>
<param-value>/WEB-INF/conf/struts-module2.xml</param-value>
</init-param>
...
3) You use
<html:form action="/someAction">
...
</html:form>
4) And you get a "javax.servlet.ServletException: Cannot retrieve mapping for action '/someAction' at [insert a massive stack trace]
Then:
5a) Check your web.xml file to see if the configuration resources in (2) are declared properly
5b) Check your struts-config-
5c) Check your tiles-def-xx
5d) Replace:
<html:form>
with the basic:
<form action="/module1/someAction.do">
to confirm that the action is working
6) As a last resort, remove the moduled implementation of the configuration scripts like so:
...
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/conf/struts-default.xml</param-value>,
<param-value>/WEB-INF/conf/struts-module1.xml</param-value>,
<param-value>/WEB-INF/conf/struts-module2.xml</param-value>
</init-param>
...
7) Check to see if this solves the error in (4). If it does, remove all context references (module1, module2 etc) from your actions.
This took me the better part of two working days to figure out, so maybe this will help some frustrated soul out there. If you know a better solution, bully for you. I shall stick to my comma-delimited lists, thank you very much.








Technorati Profile


2 Comments
:)
hi back!
Post a Comment
<< Home