Home > front end >  The server encountered an unexpected situation, stop it complete the request
The server encountered an unexpected situation, stop it complete the request

Time:09-18

HTTP Status 500 - Internal Server Error


Type abnormality report

Message in [16] [reader/index. The JSP] when an exception occurs

Description the server encountered an unexpected situation, prevent it to complete the request,

The Exception
Org. Apache. Jasper. JasperException: in [16] processing/reader/index. The JSP exception occurs when the

13:/* List List=will. GetList (null); */
14: Genre Genre=new Genre ();
15: String keyword=request. The getParameter (" keyword ");
16: List List=will. GetList (keyword);
17: List Clist=genre. GetList ();
18:
19: % & gt;


Stacktrace:
Org. Apache. Jasper. Servlet. JspServletWrapper. HandleJspException (JspServletWrapper. Java: 625)
Org. Apache. Jasper. Servlet. JspServletWrapper. Service (514) JspServletWrapper. Java:
Org. Apache. Jasper. Servlet. JspServlet. ServiceJspFile (JspServlet. Java: 385)
Org. Apache. Jasper. Servlet. JspServlet. Service (329) JspServlet. Java:
Javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 741)
Org, apache tomcat, websocket server. WsFilter. DoFilter (53) WsFilter. Java:


Root Cause
Java. Lang. NullPointerException
Org. Dal. Will the getList (will be) Java: 32)
Org. Apache. JSP. Reader. Index_jsp. _jspService (index_jsp. Java: 140)
Org. Apache. Jasper. Runtime. HttpJspBase. Service (HttpJspBase. Java: 70)
Javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 741)
Org. Apache. Jasper. Servlet. JspServletWrapper. Service (476) JspServletWrapper. Java:
Org. Apache. Jasper. Servlet. JspServlet. ServiceJspFile (JspServlet. Java: 385)
Org. Apache. Jasper. Servlet. JspServlet. Service (329) JspServlet. Java:
Javax.mail. Servlet. HTTP. HttpServlet. Service (HttpServlet. Java: 741)
Org, apache tomcat, websocket server. WsFilter. DoFilter (53) WsFilter. Java:




What went wrong, can also run half a month ago, every day running, appear this problem these days, bosses help and have a look

CodePudding user response:

Package org.com mon;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

Public class Conn {
The Connection conn=null;
The Statement STMT=null;
The ResultSet rs=null;
Public Conn () {
Try {
Class.forName("com.mysql.jdbc.Driver");
} the catch (a ClassNotFoundException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}

}
/* *
* @ param SQL
* @ return
*/
Public ResultSet executeQuery (String SQL) {
Try {
Conn=DriverManager. GetConnection (" JDBC: mysql://localhost: 3306/will be? useUnicode=true& CharacterEncoding=utf-8; ZeroDateTimeBehavior=convertToNull ", "root", "123456");
STMT=conn. CreateStatement ();
Rs=STMT. ExecuteQuery (SQL);
} the catch (SQLException e) {
e.printStackTrace();
}
Return the rs;
}
/* *
* @ param SQL
* @ return
*/
Public int executeUpdate (String SQL) {
Int result=0;
Try {
Conn=DriverManager. GetConnection (" JDBC: mysql://localhost: 3306/will be? useUnicode=true& CharacterEncoding=utf-8; ZeroDateTimeBehavior=convertToNull ", "root", "123456");
STMT=conn. CreateStatement (ResultSet. TYPE_SCROLL_INSENSITIVE, ResultSet. CONCUR_READ_ONLY);
Result=STMT. ExecuteUpdate (SQL);
} the catch (SQLException e) {
//TODO Auto - generated the catch block,
Result=0;
}
return result;
}

Public void the close () {
If (rs!=null)
Try {
rs.close();
} the catch (SQLException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}
If (STMT!=null)
Try {
STMT. Close ();
} the catch (SQLException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}
if(conn!=null)
Try {
conn.close();
} the catch (SQLException e) {
//TODO Auto - generated the catch block,
e.printStackTrace();
}
}
}

Connect to the database, the rs is empty, how to change
  • Related