• Post Reply Bookmark Topic Watch Topic
  • New Topic

HTTP Status 500 - Unable to compile class for JSP:

 
Srinivas Adapa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam getting following error when i run this code





HTTP Status 500 - Unable to compile class for JSP:

type Exception report

message Unable to compile class for JSP:

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

exception

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 12 in the jsp file: /login.jsp
uname cannot be resolved to a variable
9: Statement st = con.createStatement();
10: //out.println("Database connected successful");
11: ResultSet rs;
12: rs = st.executeQuery("select * from members where uname= '" + uname + "' and pass= '" + pass + "' ");
13: if (rs.next()) {
14: session.setAttribute("userid", userid);
15: //out.println("welcome " + userid);


An error occurred at line: 12 in the jsp file: /login.jsp
pass cannot be resolved to a variable
9: Statement st = con.createStatement();
10: //out.println("Database connected successful");
11: ResultSet rs;
12: rs = st.executeQuery("select * from members where uname= '" + uname + "' and pass= '" + pass + "' ");
13: if (rs.next()) {
14: session.setAttribute("userid", userid);
15: //out.println("welcome " + userid);


Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:198)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:361)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:363)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.35 logs.
 
Srinivas Adapa
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i run the below code it was working fine without any errors:




Please help me where it went wrong.
 
Dave Tolls
Ranch Hand
Posts: 2271
23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For starters you have code in your JSP page.

But for the immediate error:
uname cannot be resolved to a variable
and
pass cannot be resolved to a variable

'uname' and 'pass' are used in your SQL, but where are they declared?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!