title: Changing struts.xml file name for a multi-module Maven web project
body: <p>I have a Maven project with multiple modules. Out of four modules, two of them are web modules.</p>
  
  <p>Here is the structure.</p>
  
  <pre><code>MyProject
     |
     |__ api
     |
     |__ commons
     |
     |__ web_child
     |
     |__ web_main
  </code></pre>
  
  <p><code>web_main</code> module is the main one and it can include <code>web_child</code> module also.</p>
  
  <p><code>web_child</code> module structure is</p>
  
  <pre><code> web_child
       |
       |__ src/main/java //java action classes and all
       |__ src/main/resources
       |    |__ struts-config.xml
       |
       |__ WEB-INF
            |__ JSP Pages
  </code></pre>
  
  <p><code>web_main</code> module structure is</p>
  
  <pre><code> web_main
       |
       |__ src/main/java //java action classes and all
       |__ src/main/resources
       |    |__ struts.xml
       |
       |__ WEB-INF
            |__ JSP Pages
  </code></pre>
  
  <p>Both modules are <code>war</code>. </p>
  
  <p><code>web-main</code> depends on all the modules, and <code>web-child</code> depends on first two (API &amp; commons) modules.</p>
  
  <p>in <code>web-main</code>'s <code>pom.xml</code>, I'm adding the dependency for <code>web-child</code> and it will automatically add other two jars.</p>
  
  <p>The main module <code>web-main</code> is running perfectly on server. </p>
  
  <p>But when I am trying to run the <code>web-child</code> module alone, it is showing error like </p>
  
  <pre><code>There is no Action mapped for namespace [/] and action name [childMenu] associated with context path ...  
  </code></pre>
  
  <p>Because it is not taking the <code>struts-config.xml</code></p>
  
  <p>When I am renaming the file to <code>struts.xml</code>, <code>web-child</code> is working fine. But that time main module is not running.</p>
  
  <p>So I want to rename the <code>struts.xml</code> in child module to <code>struts-config.xml</code> and I need to specify it explicitly. </p>
  
  <p>I am using Struts2. But I have tried the following in <code>web.xml</code> and obviously it didn't work</p>
  
  <pre><code>&lt;servlet&gt;
      &lt;servlet-name&gt;action&lt;/servlet-name&gt;
      &lt;servlet-class&gt;org.apache.struts.action.ActionServlet&lt;/servlet-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;config&lt;/param-name&gt;
          &lt;param-value&gt;../resources/struts-config.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
    &lt;/servlet&gt;
  </code></pre>
  
  <p>How to solve this problem?</p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>Hi, I added following in my web-child web.xml</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;init-param&gt;
          &lt;param-name&gt;config&lt;/param-name&gt;
          &lt;param-value&gt;struts-config.xml&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/filter&gt;
  </code></pre>
  
  <p>And I am getting following exception. Do I need to add any dependency?</p>
  
  <pre><code>SEVERE: Exception starting filter struts2
  Unable to load configuration. - [unknown location]
      at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:483)
      at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
      at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
      at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:281)
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:262)
      at org.apache.catalina.core.ApplicationFilterConfig.&lt;init&gt;(ApplicationFilterConfig.java:107)
      at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1653)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:724)
  Caused by: Unable to load configuration. - [unknown location]
      at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:71)
      at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:429)
      at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:471)
      ... 19 more
  Caused by: Cannot locate the chosen ObjectFactory implementation: spring - [unknown location]
      at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:391)
      at org.apache.struts2.config.BeanSelectionProvider.alias(BeanSelectionProvider.java:362)
      at org.apache.struts2.config.BeanSelectionProvider.register(BeanSelectionProvider.java:288)
      at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:215)
      at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:68)
      ... 21 more
  </code></pre>