title: Two Struts2 Filters in One Web Application
body: <p>I want to use two struts2 filters in one application. I have following filters definition in <code>web.xml</code>. "struts2" filter is already there, I just added "companion" filter.</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
      &lt;filter-class&gt;
          org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
      &lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;struts2&lt;/filter-name&gt;
      &lt;url-pattern&gt;*.abc&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  
  
  &lt;filter&gt;
      &lt;filter-name&gt;companion&lt;/filter-name&gt;
      &lt;filter-class&gt;
          org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
      &lt;/filter-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;config&lt;/param-name&gt;
          &lt;param-value&gt;companion.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;companion&lt;/filter-name&gt;
      &lt;url-pattern&gt;*.xyz&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>I have created two configuration files "struts.xml" and "companion.xml" in class path. These files are completely independent of each other. I have also define constants "struts.action.extension" for in each configuration files with appropriate values (struts2 -> abc, and companion -> xyz). Some actions and their mappings are also available in both configuration files.</p>
  
  <p>Now, when I access an action, it shows following message on my browser.</p>
  
  <p><code>Error 404: SRVE0190E: File not found: /fetchUserInfo.xyz</code>.</p>
  
  <p>Following log message is got from server log.</p>
  
  <pre><code>12/12/12 15:48:24.846, ERROR, [WebContainer : 0], Dispatcher initialization failed
  com.opensymphony.xwork2.inject.DependencyException: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=com.opensymphony.xwork2.ObjectFactory, name='default'] in public void com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.setObjectFactory(com.opensymphony.xwork2.ObjectFactory).
  at com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMembers(ContainerImpl.java:144)
  at com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMethods(ContainerImpl.java:113)
  at com.opensymphony.xwork2.inject.ContainerImpl.addInjectors(ContainerImpl.java:90)
  at com.opensymphony.xwork2.inject.ContainerImpl.addInjectors(ContainerImpl.java:86)
  at com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java:71)
  at com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java:67)
  at com.opensymphony.xwork2.inject.util.ReferenceCache$CallableCreate.call(ReferenceCache.java:150)
  at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:284)
  at java.util.concurrent.FutureTask.run(FutureTask.java:138)
  at com.opensymphony.xwork2.inject.util.ReferenceCache.internalCreate(ReferenceCache.java:76)
  at com.opensymphony.xwork2.inject.util.ReferenceCache.get(ReferenceCache.java:116)
  at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:483)
  at com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:523)
  at com.opensymphony.xwork2.inject.ContainerImpl$6.call(ContainerImpl.java:521)
  at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)
  at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:521)
  at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:203)
  at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
  at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
  at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
  at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
  at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
  at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:142)
  at com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:465)
  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:379)
  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:238)
  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:296)
  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:721)
  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:673)
  at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:688)
  at com.ibm.ws.wswebcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:96)
  at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:758)
  at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:718)
  at com.ibm.ws.wswebcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:113)
  at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3252)
  at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:264)
  at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
  at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1439)
  at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:112)
  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
  at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:263)
  at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
  at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
  at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
  at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
  at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
  at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
  at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
  at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
  at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
  
  Caused by: com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=com.opensymphony.xwork2.ObjectFactory, name='default'] in public void com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.setObjectFactory(com.opensymphony.xwork2.ObjectFactory).
  at com.opensymphony.xwork2.inject.ContainerImpl.createParameterInjector(ContainerImpl.java:235)
  at com.opensymphony.xwork2.inject.ContainerImpl.getParametersInjectors(ContainerImpl.java:225)
  at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.&lt;init&gt;(ContainerImpl.java:287)
  at com.opensymphony.xwork2.inject.ContainerImpl$3.create(ContainerImpl.java:117)
  at com.opensymphony.xwork2.inject.ContainerImpl$3.create(ContainerImpl.java:114)
  at com.opensymphony.xwork2.inject.ContainerImpl.addInjectorsForMembers(ContainerImpl.java:141)
  ... 51 more
  </code></pre>
  
  <p>Is it possible to use two filters in one application? If so the what am I missing?</p>