1

I have a war application (spring + jsf1.2/richfaces + hibernate) running on my was8.5 server, when i try to access http://localhost:9080/name_app/login.xhtml, I get java.lang.NullPointerException coming from the server internal source, below is the log trace of the error :

[28/01/16 09:45:06:325 WET]     FFDC Exception:java.lang.NullPointerException SourceId:com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters -RE ProbeId:1123 Reporter:com.ibm.ws.webcontainer.filter.WebAppFilterManagerImpl@9afb2765
java.lang.NullPointerException
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChainContents(WebAppFilterManager.java:775)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:379)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:931)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3926)
    at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
    at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
    at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
    at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
    at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
    at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
    at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
    at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
    at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
    at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
    at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
    at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)

web.xml :

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="Auth_Super_Admin_WEBAPP" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> 

    <description>Antij Project web.xml</description>
    <display-name>Antij -AuthForte-User-Admin-web</display-name>
    <context-param>
        <param-name>org.richfaces.SKIN</param-name>
        <param-value>classic</param-value>
    </context-param>
    <!-- added , but doesn't affect-->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.enableViewStateIdRendering</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>WEB-INF/web-context.xml</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.REFRESH_PERIOD</param-name>
        <param-value>1</param-value>
    </context-param>
    <context-param>
        <param-name>facelets.SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>
<!--    <context-param> -->
<!--        <param-name>javax.faces.STATE_SAVING_METHOD</param-name> -->
<!--        <param-value>server</param-value> -->
<!--    </context-param> -->
    <context-param>
        <description>
        State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>resources.application</param-value>
    </context-param>


 <context-param>
  <param-name>facelets.LIBRARIES</param-name>
  <param-value>/WEB-INF/components/antij.taglib.xml</param-value>
 </context-param>
<!--   -->


    <filter>
        <filter-name>extensionsFilter</filter-name>
        <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
        <init-param>
            <description>Set the size limit for uploaded files.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
            <param-name>uploadMaxFileSize</param-name>
            <param-value>100m</param-value>
        </init-param>
        <init-param>
            <description>Set the threshold size - files below this limit are stored
in memory, files above this limit are stored on disk.
Format: 10 - 10 bytes
10k - 10 KB
10m - 10 MB
1g - 1 GB
</description>
            <param-name>uploadThresholdSize</param-name>
            <param-value>100k</param-value>
        </init-param>
    </filter>
    <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>
    <filter>
        <filter-name>springSecurityFilterChain</filter-name>
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <filter-mapping>
        <filter-name>extensionsFilter</filter-name>
        <servlet-name>*.xhtml</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>springSecurityFilterChain</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping> 
    <!-- listener to load spring beans -->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>
    <!-- Faces Servlet -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <!-- Faces Servlet Mapping -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.xhtml</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>/modules/index.xhtml</welcome-file>
    </welcome-file-list>
    <!--
    <resource-ref>
        <description>My Data Source.</description>
        <res-ref-name>acs_3ds</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>-->

    <!-- resource ref for websphere -->

     <resource-ref>
       <res-ref-name>jdbc/acs_3ds_websphere_db</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       <res-sharing-scope>Shareable</res-sharing-scope>
    </resource-ref>

    <persistence-unit-ref>
       <persistence-unit-ref-name>persistence/authentification-forte-user-admin-entityManager-pu</persistence-unit-ref-name>
       <persistence-unit-name>authentification-forte-user-admin-entityManager-pu</persistence-unit-name>
    </persistence-unit-ref>
</web-app>

According to the log trace it didn't originate in own code, I think it's about some misconfiguration in web.xml , Am not sure.

How is this caused and how can I solve it?

  • 1
    Possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it) – Jens Jan 28 '16 at 10:08
  • 1
    Thanks for your reply @Jens , but I can't figure out what's the common things between my post and the one that you suggested. –  Jan 28 '16 at 10:16
  • This porblem may be caused by some misconfiguration in my `web.xml` (probably with the filter-mapping ), @BalusC have you any idea ? –  Jan 28 '16 at 10:23
  • 1
    Regardless of misconfiguration, NullPointerException probably should not happen within the application server's code. I would recommend opening a PMR with IBM. – Brett Kail Jan 28 '16 at 14:47
  • Like @BrettKail said, you should open a PMR with IBM. Also, you should consider capturing the WebContainer MustGather and adding that to the PMR: http://www-01.ibm.com/support/docview.wss?uid=swg21384592 – ZRoman Jan 28 '16 at 16:05
  • Have you an example of basic configuration for datasource, persistence unit, .. that matched with websphere8.5 –  Jan 28 '16 at 17:21

1 Answers1

0

I experienced this same bug and found a solution.

Find which filter is causing this error by removing the filters from web.xml one at a time until you don't get this error.

Then rename that filter in both <filter><filter-name> and <filter-mapping><filter-name>. Note that filter-name can be any string but that values must match. It does not need to be the same name as your filter class name only <filter-class> needs to be the same name as your class.

Now try running it and it should work. You should now be able to rename your filter to it's original name.

Philip Rego
  • 552
  • 4
  • 20
  • 35