I'm trying to migrate my struts application from 2.3.31 to 2.5.8 but it appears 
that my struts.xml is not getting loaded. My web.xml is pretty standard:

<?xml version="1.0"?>
<web-app id="app-name" version="3.0"
  xmlns="http://java.sun.com/xml/ns/javaee"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_3_0.xsd";
>
  <display-name>app-name</display-name>
  <icon />
  <description />
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
  <filter>
    <filter-name>struts2</filter-name>
    
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>*.action</url-pattern>
  </filter-mapping>

Then my struts.xml which worked fine in 2.3.31 but is not working in 2.5.8

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
  "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
  "http://struts.apache.org/dtds/struts-2.3.dtd";>
<struts>
       <!-- Load in the default Struts configuration so we get all the basic 
interceptors.
             This is in the struts-core jar file if you need to look at it for 
reference. -->
       <!-- <include file="struts-default.xml" /> -->

       <!-- Explicitly use the struts Object Factory automatic default. Default
             options with no plugins are 'struts' and 'xwork'. To use 'spring', 
you need
             to include the struts-spring-plugin in pom.xml and configure it 
properly -->
       <constant name="struts.objectFactory" value="struts" />

       <!-- Max file upload size of 250 MB -->
       <constant name="struts.multipart.maxSize" value="262144000" />

       <include file="my-base.xml" />
       <include file="my-json-actions.xml" />
</struts>


The struts.xml file is in my resources directory, and I verified it's being 
copied properly to webapp/WEB-INF/classes. However, when I start up my 
application in Tomcat, the StrutsPrepareAndExecuteFilter init method is called, 
but my actions as defined in my-json-actions.xml are not initialized. It 
appears that the struts.xml file is not loaded at all. I'm also not seeing any 
exceptions or error messages output.

Do I need to do something different in 2.5 to get my actions loading? My action 
definitions look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd";>
<struts>
       <include file="my-json-base.xml" />
       <package name="my-json" namespace="/json" extends="my-json-base">
             <action name="Account!*"
                    class="my.actions.json.AccountAction"
                    method="{1}">
                    <interceptor-ref name="myInterceptor" />
             </action>

Any help would be greatly appreciated! Thanks

--
John

Reply via email to