java错误代码,http500

在使用Servlet执行插入数据库操作时无法插入
使用的是MyEclipse和mysql以及tomcat6.0.41
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
response.setContentType("text/html");
String account = request.getParameter("account1");
String password = request.getParameter("password1");
Connection conn = null;
Statement stmt = null;
try{
    // ��̬������ݿ����
    Class.forName("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection(
    "jdbc:mysql://localhost:3306/test", "root", "123456");
    String sql = "INSERT INTO userlogin ( name,passward ) VALUES (  '"+account+"', '"+password+"'  )";
    stmt = conn.createStatement();
    stmt.executeUpdate(sql);
}catch(Exception e){
    e.printStackTrace();
}finally{
    try {
        stmt.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
    try {
        conn.close();
    } catch (SQLException e) {
        e.printStackTrace();
    }
}
报错内容为:

type Exception report

message

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

exception

java.lang.NullPointerException
com.lmc.homework.test.ServletInsert.doPost(ServletInsert.java:37)
javax.servlet.http.HttpServlet.service(HttpServlet.java:643)
javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.41 logs.

尝试用同样的代码去写一个简单的插入数据库的demo,发现可以正常插入,报错中提醒的第37行代码是stmt.close();
请各位批评指正

37为空,说明stam为空,也就说明try里面没有正常执行。而这个错误你没有截出来,不好定位

stmt.close()空指针那就是 stmt为空了呀