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

NullPointerException instead of "There is no Action mapped for namespace..." (regression?)

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.3.1.2
    • 2.3.3
    • Core Actions
    • None

    Description

      After upgrading to Struts 2.3.1.2, we get a Nullpointer when trying to access an undefined action (in example, /badurl.do) - see complete stack below.
      This is because ServletActionContext.getRequest() is NULL when getErrorMessage() gets called.
      This is a major issue because it prevents 404 error to be handled correctly and it affects several websites (just Google for "org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)")

      Edit: maybe is it due to the fact I'm using deprecated FilterDispatcher...

      java.lang.NullPointerException
      org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
      com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
      org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
      org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
      com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
      org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500)
      org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:434)
      [my filter extends FilterDispatcher]
      com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)
      com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)
      org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)

      Attachments

        Activity

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

          People

            lukaszlenart Lukasz Lenart
            awalter Antoine W
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment