How to Use UnmappedResourceHandler

429 Views Asked by At

Before I go post an issue, Hope you can answer this (looks like a bug) brand new project, GF 4.0, OmniFaces 1.6.3

Followed all instructions, but getting this exception

Caused by: java.lang.NullPointerException
at org.omnifaces.util.FacesLocal.getRequestMap(FacesLocal.java:913)
at org.omnifaces.util.FacesLocal.getRequestAttribute(FacesLocal.java:921)
at org.omnifaces.util.Faces.getRequestAttribute(Faces.java:1381)
at org.omnifaces.eventlistener.CallbackPhaseListener.getCallbackPhaseListeners(CallbackPhaseListener.java:110)
at org.omnifaces.eventlistener.CallbackPhaseListener.afterPhase(CallbackPhaseListener.java:77)
at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:647)
... 37 more

This works: localhost:8080/WEB-APP/javax.faces.resource/layout/my_layout.css

This does NOT work (Exception above): localhost:8080/WEB-APP/javax.faces.resource/layout/my_layout.css.html

This does NOT work (Exception above): localhost:8080/WEB-APP/javax.faces.resource/layout/my_layout.css.jsf

<h:graphicImage> , <h:outputStylesheet> etc. will generate the .jsf / .html extension, thus all fails.

1

There are 1 best solutions below

0
Lenny Primak On

This can happen when UnmappedResourceHandler isn't actually included in faces-config.xml

My faces-config.xml has <javaee:faces-config> instead of <faces-config> so none of the directives inside were actually getting executed.