Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-2866

A ServletException without details seems thrown when an action listed in Struts.xml is not found, add details in the exception and log a fatal error

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Not A Problem
    • Affects Version/s: 2.0.11
    • Fix Version/s: 2.1.8
    • Component/s: XML Configuration
    • Labels:
      None
    • Environment:

      Windows XP SP2, Tomcat 5.5 JDK 1.5.0.12

      Description

      A ServletException without details seems thrown when an action listed in Struts.xml is not found, add details in the exception and log a fatal error

      Take your struts.xml which runs fine and having a line such as
      <action name="home" class="pwgsc.rpgis.struts.common.HomeAction">
      <result type="tiles" name="success">home</result>
      </action>

      Now in your IDE, rename the class HomeAction to HomePageAction or move it in a different package.
      My RSA IDE knows nothing about Struts 2 so suddenly struts.xml is no more accurate.

      Start the server, on the initialization of the Struts2 filter, in init() the file seems to be parsed and certainly instances of the actions created. Whatever, the init() fails and all I get from the Tomcat output is "SEVERE: Error filterStart."

      I have tried to increase the logging, log4j being configured and initialized before Struts2 with Struts2 and XWork both configured as DEBUG
      I have struts.devMode = true in struts.properties
      No way to figure out what it was. It took me some time to figure out what was the issue.

      The problem can be reproduced every time.

      I strongly suggest to create a clear ServletException in your filter using the constructor with the String specifying the offending class or the part of the configuration file(s) which is bad (file + line)

      In addition of that, I would suggest to use commons logging to display a clear fatal message with details.
      It's quite weird to see all the amount of logging when it is turned on when processing a request while nothing is logged at the initialization of the filter.

      Thanks

      Olivier

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              odupuy olivier dupuy
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: