0

I'm getting this error..

exception   
org.apache.jasper.JasperException: An exception occurred processing [/admin-login.jsp] at line [52]

49:                                 <%
50:                                     //Connecting to the database
51:                                     Connection connection = DatabaseConnection.getConnection();
52:                                     Statement statement = connection.createStatement();
53:                                     String credential = (String) session.getAttribute("credential");
54:                                     //Checking creditionals whether there are null or not
55:                                     if (credential != null) {



Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:610)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:499)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:379)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:327)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:596)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Slaw
  • 37,820
  • 8
  • 53
  • 80
  • (1) I guess your connection is null. You are using `connection.createStatement()` without first checking whether the connection is null. (2) `Connection connection = DatabaseConnection.getConnection(); if (connection == null) System.err.println("connection is null"); Statement statement = connection.createStatement();` (3) `if (connection == null) System.err.println("connection is null");` is only for debug. – life888888 Mar 18 '23 at 13:23

0 Answers0