IBM Support

PH17559: NULLPOINTEREXCEPTION OCCURS IF A FILTER IS FIRST MAPPED TO A NAMED SERVLET, BUT THE NAMED SERVLET IS ADDED LATER

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • NullPointerException during the filter processing of a web
    request
    

Local fix

  • The null pointer exception does not occur if either
    - the
    servlet is defined before the filter mapping
    - or the filter
    mapping is defined with url patterns instead of a named
    servlet
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  IBM WebSphere Application Server version    *
    *                  9.0 and Liberty users of                    *
    *                  WebContainer                                *
    ****************************************************************
    * PROBLEM DESCRIPTION: A NullPointerException might occur      *
    *                      while a request is serviced.            *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    An application is using the servlet APIs
    javax.servlet.FilterRegistration.Dynamic
    javax.servlet.ServletRegistration.Dynamic
    to programmatically add its servlet and filter
    definitions.
    If an application first adds a filter and maps it to a named
    servlet, for example:
    FilterRegistration.Dynamic filter = servletContext.addFilter(
    "myFilter" , myFilter.class);
    filter.addMappingForServletNames(dispatcherTypes,
    true,"myServlet");
    Where the target servlet "myServlet" has not been defined at
    this point, and it is going to be defined later with
    ServletRegistration.Dynamic servlet =
    servletContext.addServlet("myServlet" , myServlet.class);
    then a NullPointerException might occur during the service of
    a request if it matches the filter's mapping.
    Example of the exception:
    [x/xx/xx xx:xx:xx:xxx GMT] 000000a5
    webapp E com.ibm.ws.webcontainer.webapp.WebApp logServletError
    SRVE0293E: [Servlet Error]-[xxxx]:
    java.lang.NullPointerException
    at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChai
    nContents(WebAppFilterManager
    .java:777)
    at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChai
    n(WebAppFilterManager.java:373)
    at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebA
    ppFilterManager.java:933)
    at
    com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters
    (WebAppFilterManager.java:1109)
    at
    com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:
    4217)
    ...
    Defining the servlet prior to filter mapping should address
    the issue without this fix.  However, this rearrangement does
    not work with embedded Spring Boot, which always invokes
    filters prior to servlets.
    

Problem conclusion

Temporary fix

Comments

APAR Information

  • APAR number

    PH17559

  • Reported component name

    WEBS APP SERV N

  • Reported component ID

    5724H8800

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2019-09-30

  • Closed date

    2019-12-11

  • Last modified date

    2020-02-24

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WEBS APP SERV N

  • Fixed component ID

    5724H8800

Applicable component levels

  • R900 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
02 November 2021