0

i am getting jasper exception on running jsp file

 <body>
   <%
   Connection con=ConnectionProvider.getConnect();
   %>
   <h1><%=con %></h1>

getConnect is method in another java class where i have loaded the connection driver

public static Connection getConnect(){
try{


   if(con==null){
        Class.forName("com.mysql.jdbc.Driver");
    con=DriverManager.getConnection("jdbc:mysql://localhost://3306/techblog","root","");    

   }

}
catch(Exception e){
    e.printStackTrace();
}
return con;

}

here is the fullStackTrace.could it be because i m using jdk11 with netbeans 11 as i read it somewhere that netbeans11 isnt supporting jdk latest versions? HTTP Status 500 – Internal Server Error Type Exception Report Message An exception occurred processing [/index.jsp] at line [20] Description The server encountered an unexpected condition that prevented it from fulfilling the request. Exception

17:     </head>
18:     <body>
19:        <%
20:        Connection con=ConnectionProvider.getConnect();
21:        %>
22:        <h1><%=con %></h1>
23:         <script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>

and here is the stacktrace

    Stacktrace:
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:617)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:514)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)


Root Cause
java.lang.RuntimeException: 
    com.tech.blog.helper.ConnectionProvider.getConnect(ConnectionProvider.java:1)
    org.apache.jsp.index_jsp._jspService(index_jsp.java:129)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:71)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Dakshesh
  • 1
  • 1

0 Answers0