1
votes

I am using Richfaces 3.3.1 and MyFaces 1.2. I required to add File Upload in my JSF form. I made a simple JSF form in which there was only one tag that is rich:fileupload, it was running properly and i added Listener too and the file was getting saved on the path I added. But, as soon as I try to add some other tag in the page I get an exception which I could not figure out.

java.lang.NullPointerException
    at javax.faces.webapp._ErrorPageWriter.writeVariables(_ErrorPageWriter.java:329)
    at javax.faces.webapp._ErrorPageWriter.writeVariables(_ErrorPageWriter.java:305)
    at javax.faces.webapp._ErrorPageWriter.debugHtml(_ErrorPageWriter.java:187)
    at javax.faces.webapp._ErrorPageWriter.handleThrowable(_ErrorPageWriter.java:494)
    at javax.faces.webapp._ErrorPageWriter.handleException(_ErrorPageWriter.java:479)
    at javax.faces.webapp.FacesServlet.handleLifecycleException(FacesServlet.java:294)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:192)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:347)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:620)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:745)
1

1 Answers

3
votes

This is caused by a bug in MyFaces error handler itself.

Somewhere in your code an exception occurred. MyFaces was trying to render a "nice" error page with some debug information and all about that exception. However, during rendering of that "nice" error page, it bugged with a NullPointerException and hence it couldn't finish the job to inform you about that exception. All detail about that underlying exception is apparently completely lost.

This is indeed not helpful. You could for now disable the MyFaces "nice" error page by adding the below entry to webapp's web.xml as per MyFaces documentation:

<context-param>
    <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
    <param-value>false</param-value>
</context-param>

This should present you the server default error page with the detail about the actual exception, so that you can finally investigate and fix it the usual way.

You can also try upgrading MyFaces 1.2 to latest 1.2.x available, which is currently 1.2.12, and see if the bug in its error handling is solved over there.