Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-2283

STRUTS Application still services requests although ActionServlet failed to initialize.

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.1.0
    • 1.2 Family
    • Core
    • None
    • Operating System: All
      Platform: All
    • 32248

    Description

      I have a struts 1.1 app with a typical default index.jsp redirecting to the
      entry point action:

      <logic:redirect forward="/startForm3"/>

      This was failing to because of the following NPE:


      java.lang.NullPointerException
      at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:521)
      at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:436)
      at org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:396)
      at org.apache.struts.taglib.logic.RedirectTag.doEndTag(RedirectTag.java:294)

      I can see from a quick google that this is a frequently experienced problem and
      yet I have not seen a satisfactory solution.

      If we look into the RequestUtils code we find that the problem is that the
      ModuleConfig cannot be found on either the request or in the application
      context. When the forward config for the string in the jsp is looked up we
      therfore get the NPE.

      If we look into the container logs we find the root cause: the ActionServlet
      failed to load:


      javax.servlet.ServletException: Error instantiating servlet class
      org.apache.struts.action.ActionServlet
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:986)
      ...
      ----- Root Cause -----
      java.lang.NoClassDefFoundError: javax/sql/DataSource
      at java.lang.ClassLoader.defineClass0(Native Method)

      One assumes that the ActionServlet did not load the ModuleConfig, and that the
      application is not therefore really viable - although it seems to think it is...

      My question is, should the application be attempting to service requests if its
      central component failed to boot correctly?

      The side effects this causes are hard to diagnose and I suggest that it would be
      better if, in situations like this, all further requests were responded to with
      an Error 500 and the stacktrace for the original problem - or something similar.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            mrdon Donald J. Brown
            daffinm Morgan Stanley
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment