关于用xml配置Servlet的问题

来源:百度知道 编辑:UC知道 时间:2024/07/08 14:28:20
最近在自学这个,下载了些视频和材料,每次都报这个错,请高手帮帮忙
以下是报错

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

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

exception

java.lang.NullPointerException
com.wy.tool.JDBConnection.executeQuery(JDBConnection.java:52)
com.wy.dao.ConsumerDao.getConsumerForm(ConsumerDao.java:98)
com.wy.webiter.ConsumerServlet.checkConsumer(ConsumerServlet.java:169)
com.wy.webiter.ConsumerServlet.doGet(ConsumerServlet.java:16)
com.wy.webiter.ConsumerServlet.doPost(ConsumerServlet.java:186)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.13 logs.

------

空指针异常
com.wy.tool.JDBConnection.executeQuery(JDBConnection.java:52)

你的连接数据库的connection有没有创建成功哦?
System.out.println(connection);
打印出来看下

这个应用有数据库连接操作,请问你有数据库吗?一般上传到网上的只有源代码,没有数据库的。你看一下源代码中数据库连接部分的代码 可以查看出它用的是什么数据库。看SQL语句的话大概能猜到表的结构。