Struts Developers - Upgrade To Version

In January 2012, the Struts development team released version for general availability. This version fixes a nasty security vulnerability and "all developers are strongly encouraged to update existing Struts 2 applications to Struts" ( The release notes are here:

I upgraded a medium-sized Struts 2 project to version After the upgrade I had to make these changes to my source code.

1. In pom.xml remove the dependency on javassist as this jar is now a transitive dependency of the Struts 2 core.

2. Change the import path for StringUtils - import org.apache.commons.lang.xwork.StringUtils to import org.apache.commons.lang.StringUtils; we were using a version of StringUtils that was in the xwork-core-2.2.1.jar instead of the one that is part of the commons-lang jar. The new version of xwork (used by Struts no longer has that StringUtils class.

3. Change the getContextConfiguration() method in the JUnit tests of our Action classes from:

    public String getContextLocations() {
        return "applicationContextTest.xml";


    public String[] getContextLocations() {
        return new String [] {"applicationContextTest.xml"};

In the version of the Struts JUnit plugin the getContextConfigurations method was changed to return a String array instead of just a String. So when overriding that method to specify the name of your Spring configuration file (which you need to do if it differs from the default name and location) you need to return a String array.

After upgrading the Struts 2 dependencies to version, I ran all the project's unit tests and all tests passed, including those that test the Struts 2 Action classes.

There have been a couple of bugs found in version that involve using the Struts Portlet plugin. See: and

If you do find any issues after upgrading to version, be sure to email the Struts 2 user's list (see: You can also read an archive of the Struts 2 mailing list here:

Related Blog Entries

Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version Contact Blog Owner