winston-dsouza/Online-Food-Ordering-System

HTTP Status 500 – Internal Server Error

Opened this issue · 0 comments

Hello,

"foody" was built successfully but it displayed this error screen instead of the ordering app. Please help.

HTTP Status 500 – Internal Server Error
Type Exception Report

Message An exception occurred processing [/index.jsp] at line [47]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.apache.jasper.JasperException: An exception occurred processing [/index.jsp] at line [47]

44:                         <%
45:                             //Getting all cart details of the customer
46:                             ResultSet resultCount = DatabaseConnection.getResultFromSqlQuery("select count(*) from tblcart where customer_id='" + session.getAttribute("id") + "'");
47:                             resultCount.next();
48:                             int count = resultCount.getInt(1);
49:                         %>
50:                         <h3>


Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:605)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:498)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:383)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:331)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause

java.lang.NullPointerException: Cannot invoke "java.sql.ResultSet.next()" because "resultCount" is null
	org.apache.jsp.index_jsp._jspService(index_jsp.java:162)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:465)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:383)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:331)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:764)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.

Apache Tomcat/8.5.78