I am having some trouble getting the CompositeActionMapper to work
properly. I have the following specified in my struts.properties:
struts.mapper.class=org.apache.struts2.dispatcher.mapper.CompositeAction
Mapper
struts.mapper.composite=org.apache.struts2.dispatcher.mapper.DefaultActi
onMapper,org.apache.struts2.dispatcher.mapper.RestfulActionMapperorg.apa
che.struts2.dispatcher.mapper.Restful2ActionMapper
I have verified that my application is using the
CompositeActionMapper, but I always get a 404 error when trying any
URL for my application. After some digging, I have traced the issue
to the setActionMappings method in CompositeActionMapper:
@Inject(StrutsConstants.STRUTS_MAPPER_COMPOSITE)
public void setActionMappers(String list) {
if (list != null) {
String[] arr = list.split(",");
for (String name : arr) {
Object obj = container.getInstance
(ActionMapper.class, name);
if (obj != null) {
actionMappers.add((ActionMapper) obj);
}
}
}
}
I verified that the list of mappers I want to use is being passed in
to this method correctly. When it invokes the container.getIntance()
method, however, the result is always null. Thus, the actionMappers
list in CompositeActionMapper is always empty, and every request gets
a null value, and hence a 404 error.
My question is: am I missing some step in the configuration? Is
there a reason why CompositeActionMapper can't get references to the
ActionMappers I specify?
thanks!
--Deryl