java.lang.NullPointerException

Sakai JIRA | Renaud Waldura | 8 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Accessing any invalid URL generates an error. E.g. http://localhost:8080/fedora/xxx yields the page: HTTP Status 404 - -------------------------------------------------------------------------------- type Status report message description The requested resource () is not available. -------------------------------------------------------------------------------- Apache Tomcat/5.5.27 And the following error appears in the log: ERROR 2009-02-04 10:29:44.966 [http-80-Processor2] ([jsp]) Servlet.service() for servlet jsp threw exception java.lang.NullPointerException at org.apache.jsp.jsp.notfound_002d404_jsp._jspService(notfound_002d404_jsp.java:76) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:364) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:285) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) 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:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875) 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:689) at java.lang.Thread.run(Thread.java:595) Feb 4, 2009 10:29:44 AM org.apache.catalina.core.StandardHostValve custom SEVERE: Exception Processing ErrorPage[errorCode=404, location=/jsp/notfound-404.jsp] org.apache.jasper.JasperException: Exception in JSP: /jsp/notfound-404.jsp:23 20: <h3>No such object, datastream, or dissemination.</h3> 21: </center> 22: <% 23: if (exception.getMessage() != null) { 24: out.print(exception.getMessage()); 25: } 26: %> Stacktrace: at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:364) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:285) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) 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:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875) 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:689) at java.lang.Thread.run(Thread.java:595) The fix is simple and works: Index: src/war/fedora/jsp/notfound-404.jsp =================================================================== --- src/war/fedora/jsp/notfound-404.jsp (revision 7890) +++ src/war/fedora/jsp/notfound-404.jsp (working copy) @@ -20,7 +20,7 @@ <h3>No such object, datastream, or dissemination.</h3> </center> <% -if (exception.getMessage() != null) { +if (exception != null && exception.getMessage() != null) { out.print(exception.getMessage()); } %>

    Sakai JIRA | 8 years ago | Renaud Waldura
    java.lang.NullPointerException
  2. 0

    Accessing any invalid URL generates an error. E.g. http://localhost:8080/fedora/xxx yields the page: HTTP Status 404 - -------------------------------------------------------------------------------- type Status report message description The requested resource () is not available. -------------------------------------------------------------------------------- Apache Tomcat/5.5.27 And the following error appears in the log: ERROR 2009-02-04 10:29:44.966 [http-80-Processor2] ([jsp]) Servlet.service() for servlet jsp threw exception java.lang.NullPointerException at org.apache.jsp.jsp.notfound_002d404_jsp._jspService(notfound_002d404_jsp.java:76) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:364) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:285) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) 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:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875) 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:689) at java.lang.Thread.run(Thread.java:595) Feb 4, 2009 10:29:44 AM org.apache.catalina.core.StandardHostValve custom SEVERE: Exception Processing ErrorPage[errorCode=404, location=/jsp/notfound-404.jsp] org.apache.jasper.JasperException: Exception in JSP: /jsp/notfound-404.jsp:23 20: <h3>No such object, datastream, or dissemination.</h3> 21: </center> 22: <% 23: if (exception.getMessage() != null) { 24: out.print(exception.getMessage()); 25: } 26: %> Stacktrace: at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 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.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:364) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:285) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137) 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:174) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875) 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:689) at java.lang.Thread.run(Thread.java:595) The fix is simple and works: Index: src/war/fedora/jsp/notfound-404.jsp =================================================================== --- src/war/fedora/jsp/notfound-404.jsp (revision 7890) +++ src/war/fedora/jsp/notfound-404.jsp (working copy) @@ -20,7 +20,7 @@ <h3>No such object, datastream, or dissemination.</h3> </center> <% -if (exception.getMessage() != null) { +if (exception != null && exception.getMessage() != null) { out.print(exception.getMessage()); } %>

    Sakai JIRA | 8 years ago | Renaud Waldura
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.apache.jsp.jsp.notfound_002d404_jsp._jspService()
    2. org.apache.jsp
      notfound_002d404_jsp._jspService
      1. org.apache.jsp.jsp.notfound_002d404_jsp._jspService(notfound_002d404_jsp.java:76)
      1 frame
    3. GWT dev
      HttpJspBase.service
      1. org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
      1 frame
    4. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      1 frame
    5. GWT dev
      JspServlet.service
      1. org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
      2. org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
      3. org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
      3 frames
    6. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      1 frame
    7. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
      3. org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:679)
      4. org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      5. org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:399)
      6. org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      7. org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:364)
      8. org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:285)
      9. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      10. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
      11. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
      12. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
      12 frames
    8. Grizzly HTTP
      LeaderFollowerWorkerThread.runIt
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
      2. org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
      3. org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
      4. org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
      4 frames
    9. Tomcat Util
      ThreadPool$ControlRunnable.run
      1. org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
      1 frame
    10. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:595)
      1 frame