当前位置: 代码迷 >> Java Web开发 >> createStatement出错,该如何处理
  详细解决方案

createStatement出错,该如何处理

热度:160   发布时间:2016-04-17 00:27:24.0
createStatement出错
我的代码在其他电脑上可以用,但本机上就出现下面的错误,是哪里的错误?
XML code
HTTP Status 500 - --------------------------------------------type Exception reportmessage description The server encountered an internal error () that prevented it from fulfilling this request.exception org.apache.jasper.JasperException: An exception occurred processing JSP page /zqwu/stinfos.jsp at line 2825: catch(SQLException e){26: out.println("Connection database fail!");27: }28: Statement stmt=conn.createStatement();29: ResultSet result=stmt.executeQuery("select * from studentsinfo");30: %>31: <p></p>Stacktrace:    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)root cause java.lang.NullPointerException    org.apache.jsp.zqwu.stinfos_jsp._jspService(stinfos_jsp.java:81)    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)note The full stack trace of the root cause is available in the Apache Tomcat/6.0.33 logs.


------解决方案--------------------
把你jsp中的代码贴出来看看。。。
------解决方案--------------------
完事了散分吧。
------解决方案--------------------
一看就知道是connection为null
代码迷推荐解决方案:An exception occurred processing JSP page,http://www.daimami.com/search?q=33144
代码迷推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.daimami.com/search?q=317