NullPointerException within RichFaces when using UnmappedResourceHandler #297

torgre opened this Issue Aug 8, 2016 · 3 comments


None yet

2 participants

torgre commented Aug 8, 2016

When enabling the UnmappedResourceHandler (using faces-config.xml and web.xmlsettings as explained in OmniFaces Javadoc) and also having enabled RichFaces resourceOptimization using org.richfaces.resourceOptimization.enabledset to true a NullPointerException is thrown:

        at javax.faces.event.SystemEvent.processListener(
        at javax.faces.event.ComponentSystemEvent.processListener(
        at org.apache.myfaces.application.ApplicationImpl._traverseListenerList(
        at org.apache.myfaces.application.ApplicationImpl.access$000(
        at org.apache.myfaces.application.ApplicationImpl$SystemListenerEntry.publish(
        at org.apache.myfaces.application.ApplicationImpl.publishEvent(
        at org.apache.myfaces.application.ApplicationImpl.publishEvent(
        at javax.faces.application.ApplicationWrapper.publishEvent(
        at javax.faces.application.ApplicationWrapper.publishEvent(
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(
        at org.apache.myfaces.lifecycle.LifecycleImpl.render(
        at javax.faces.webapp.FacesServlet.service(
        at org.richfaces.webapp.ResourceServlet.httpService(
        at org.richfaces.webapp.ResourceServlet.service(
        at io.undertow.servlet.handlers.ServletHandler.handleRequest(
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(

The path the application tries to load is /portal/javax.faces.resource/org.richfaces.staticResource/4.5.17.Final/PackedCompressed/plain/packed/packed.css (portal is the context path).

The null pointer occures because FacesContext.getCurrentInstance() returns null when is called.

I was not able isolate the issue in OmniFaces directly, however I saw the following Hack for PrimeFaces in org.omnifaces.resourcehandler.UnmappedResourceHandler.createResource(FacesContext):

if (Hacks.isPrimeFacesDynamicResourceRequest(context)) {
    return null;

Using a similar approach for RichFaces did not work though (checking for the string org.richfaces.staticResource from the requested path and also returning null).

OmniFaces 2.4 and 2.5 from master used. RichFaces version 4.5.17 used on WildFly 10.0.0.Final with Apache MyFaces 2.2.8.

torgre commented Aug 9, 2016

Update: it has nothing to do with resourceOptimization, same exception also occurs on every request to each RichFaces resource when it is disabled.

@BalusC BalusC closed this in a167c33 Aug 10, 2016
BalusC commented Aug 10, 2016

Reproduced. Fix is available in today's 2.5-SNAPSHOT. Can you let me know if that works out for you as well?

torgre commented Aug 11, 2016

Works like a charm, thank you very much for the quick fix 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment