Hi, I dont not understand very much about Struts2 inject process but I fixed my problem extending the compositeActionMapper with the following one:
public class DebugCompositeActionMapper extends CompositeActionMapper { @Override @Inject(StrutsConstants.STRUTS_MAPPER_COMPOSITE) public void setActionMappers(String list) { if (list != null) { String[] arr = list.split(","); for (String name : arr) { if (container==null) continue; // LINE ADDED Object obj = container.getInstance(ActionMapper.class, name); if (obj != null) { actionMappers.add((ActionMapper) obj); } } } } } I worked since it do not throw the Null Pointer Exception and it seem during injection process the function setActionMappers is called twice. One before the container is set and other after. I hope it help. Aloha, Rafael Sobral rsilva wrote: > > I have used the following with success in Mac Os Leopard Tomcat 6.0.18 > Struts 2.0.14 Java 1.5.0.19 > > <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" > name="waves" class="struts2.urlrewrite.WavesASPActionMapper" /> > <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" > name="hierarchy" class="struts2.urlrewrite.WavesHierarchyActionMapper" /> > <constant name="struts.mapper.composite" > value="struts,waves,hierarchy" /> > <constant name="struts.mapper.class" value="composite"/> > > When I moved to CentOs Tomcat 6.0.18 Struts 2.0.14 Java 1.6.0_10 it start > throwing > > java.lang.RuntimeException: java.lang.RuntimeException: > java.lang.RuntimeException: java.lang.RuntimeException: > java.lang.reflect.InvocationTargetException > at > com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:290) > at > com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:117) > at > com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:115) > at > com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:542) > at > com.opensymphony.xwork2.inject.ContainerImpl.injectStatics(ContainerImpl.java:114) > at > com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:494) > at > com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:145) > at > com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52) > at > org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395) > at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452) > at > org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:205) > at > org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275) > at > org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397) > at > org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108) > at > org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3709) > at > org.apache.catalina.core.StandardContext.start(StandardContext.java:4363) > at > org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) > at > org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) > at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) > at > org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) > at > org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) > at > org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) > at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) > at > org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) > at > org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) > at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) > at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) > at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) > at > org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) > at > org.apache.catalina.core.StandardService.start(StandardService.java:516) > at > org.apache.catalina.core.StandardServer.start(StandardServer.java:710) > at org.apache.catalina.startup.Catalina.start(Catalina.java:578) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:177) > Caused by: java.lang.RuntimeException: java.lang.RuntimeException: > java.lang.RuntimeException: java.lang.reflect.InvocationTargetException > at > com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:136) > at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:49) > at > com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(ContainerImpl.java:431) > at > com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl.java:446) > at > com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.java:48) > at > com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:288) > ... 41 more > Caused by: java.lang.RuntimeException: java.lang.RuntimeException: > java.lang.reflect.InvocationTargetException > at > com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:464) > at > com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:501) > at > com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:549) > at > com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:499) > at > com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32) > at > com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:134) > ... 46 more > Caused by: java.lang.RuntimeException: > java.lang.reflect.InvocationTargetException > at > com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:290) > at > com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:400) > at > com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:461) > ... 51 more > Caused by: java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at > com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:288) > ... 53 more > Caused by: java.lang.NullPointerException > at > org.apache.struts2.dispatcher.mapper.CompositeActionMapper.setActionMappers(CompositeActionMapper.java:108) > ... 58 more > > It seems Struts 2 is not injecting Container reference on > CompositeActionMapper. > > Really strange. > > I tried create another Composite Action Mapper Bean called compositeMapper > and using it in struts.mapper.class but do not work too. > > Any Thoughts? > > Thank you. > > Aloha, > > afael Sobral > > > > Jeromy Evans - Blue Sky Minds wrote: >> >> Allen Lee wrote: >>> Hey there, >>> >>> >>> Has anyone successfully gotten CompositeActionMapper to work and how? >>> >>> >> >> >> <!-- Define the action mappers --> >> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" >> name="addressMapper" >> class="com.mycompany.actionmapper.CustomActionMapper" /> >> <bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" >> name="compositeMapper" >> class="org.apache.struts2.dispatcher.mapper.CompositeActionMapper" /> >> >> <!-- configure the composite order (custom mapper and the default rest >> plugin action mapper) --> >> <constant name="struts.mapper.composite" value="addressMapper,rest" /> >> >> <!-- enable the composite mapper --> >> <constant name="struts.mapper.class" value="compositeMapper"/> >> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org >> For additional commands, e-mail: user-h...@struts.apache.org >> >> >> > > -- View this message in context: http://www.nabble.com/using-CompositeActionMapper-tp19695907p24298607.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org