Exceptional Horrors

I continue to be frustrated about Java Checked Exceptions (and error logging in many Java programs). I recently ran into this beauty:

javax.servlet.jsp.JspException: javax.faces.el.EvaluationException:
Error getting property 'userList' from bean of type
to.etc.saram.jsf.vbean.UserBean: java.lang.NullPointerException
at com.icesoft.faces.component.DataTableTag.doStartTag(DataTableTag.java:677)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:162)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:186)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:186)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:186)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:186)
at com.icesoft.faces.webapp.parser.Parser.parse(Parser.java:134)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:482)
at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:150)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:125)
at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
at com.icesoft.faces.webapp.http.servlet.SingleViewServlet.service(SingleViewServlet.java:48)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:89)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
ERROR - Servlet.service() for servlet Persistent Faces Servlet threw
exception
javax.faces.FacesException: Can't parse stream for /users/userlist.jsp
Failed to execute JSP lifecycle.
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:488)
at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:150)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:107)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:268)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:137)
at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:125)
at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
at com.icesoft.faces.webapp.http.servlet.SingleViewServlet.service(SingleViewServlet.java:48)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:89)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:59)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:595)
Caused by: javax.faces.FacesException: Failed to execute JSP lifecycle.
at com.icesoft.faces.webapp.parser.Parser.parse(Parser.java:140)
at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:482)
... 31 more
Caused by: javax.servlet.jsp.JspException:
javax.faces.el.EvaluationException: Error getting property 'userList'
from bean of type to.etc.saram.jsf.vbean.UserBean:
java.lang.NullPointerException
at com.icesoft.faces.component.DataTableTag.doStartTag(DataTableTag.java:677)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:162)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:186)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:186)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:186)
at com.icesoft.faces.webapp.parser.Parser.executeJspLifecycle(Parser.java:186)
at com.icesoft.faces.webapp.parser.Parser.parse(Parser.java:134)
... 32 more

The real reason was a simple NullPointerException in my code. Where? $DEITY knows because you sure could not obtain the location from the above stack trace. Layer after layer catching exceptions and wrapping them by their own meaningless shit, obscuring the real problem.

When I see stuff like this I get urges to do nasty things with chainsaws to James Gosling and the other idiots that maintain checked exceptions are good. Making a mistake is no proble. But continuing it is gross.

Comments

Am i $DEITY ?

I must admit JSF errors are really ugly. But now i have some experience with it, i usually easily find the point in the stacktrace. Here it is at the bottom:

javax.faces.el.EvaluationException: Error getting property 'userList'

Typically this is because you forgot to define a getUserList() methiod in UserBean, but you may also have a real NPE in this method.
Anyway you have where and why the error occured... with a lot of extra, no-interesting stuff :P

Re: Exceptional Horro

Actually NPE is unchecked exception and as you know unchecked exceptions are considered as developer's errors. Every developer (including both of us) has to remember that even the best language or library can't protect you from yourself.

All the best!