• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTTP Status 500 - null pointer exception

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi

I am getting error as below please help to resolve this issue.

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /DisplayAll.jsp at line 94

91: <td width="7%" class="stylegrey"><%=status.get(i)%></td>
92: <td width="13%" class="stylegrey"><%=lastLogin.get(i)%></td>
93: <td width="12%" align="center">
94: <% if(status.get(i).equals("Disabled")) { %>
95: <a href="javascript:setlocation('<%=sid.get(i)%>','Enabled')" class="stylelink" style="text-decoration:none">Enable</a>
96: <% } else if(status.get(i).equals("Enabled")) { %>
97: <a href="javascript:setlocation('<%=sid.get(i)%>','Disabled')" class="stylelink" style="text-decoration:none">Disable</a>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:553)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:457)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)



root cause
java.lang.NullPointerException
org.apache.jsp.DisplayAll_jsp._jspService(DisplayAll_jsp.java:223)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:419)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Firstly, you should not be putting Java code into a JSP. That is an obsolete and poor practice from over 12 years ago. Do you not think that it is time to update your JSP skills to modern levels?

Next, this portion of the stack trace is the important one:

root cause
java.lang.NullPointerException
org.apache.jsp.DisplayAll_jsp._jspService(DisplayAll_jsp.java:223)


It tells you that you are making a null reference somewhere in the JSP.

Your first step should be to learn how to write web apps properly without using Java code in a JSP and to use only the JSTL and EL in the JSPs. Any Java code that is needed should be placed in Java classes that either serve as beans or controllers.

If you need a primer on JSP, please read this article.

If you'd like to learn how to properly structure a web app, see this article.
reply
    Bookmark Topic Watch Topic
  • New Topic