问题描述
连接成功java.lang.NullPointerExceptionatcom.blog.toolsBean.JDBConnection.getStm(JDBConnection.java:40)atcom.blog.toolsBean.JDBConnection.executeQuery(JDBConnection.java:71)atcom.blog.dao.ConsumerDao.getConsumerForm(ConsumerDao.java:89)atcom.blog.servlet.ConsumerServlet.registerConsumer(ConsumerServlet.java:76)atcom.blog.servlet.ConsumerServlet.doPost(ConsumerServlet.java:21)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:710)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)atjava.lang.Thread.run(UnknownSource)2010-4-2918:05:14org.apache.catalina.core.StandardWrapperValveinvoke严重:Servlet.service()forservletConsumerServletthrewexceptionjava.lang.NullPointerExceptionatcom.blog.dao.ConsumerDao.getConsumerForm(ConsumerDao.java:90)atcom.blog.servlet.ConsumerServlet.registerConsumer(ConsumerServlet.java:76)atcom.blog.servlet.ConsumerServlet.doPost(ConsumerServlet.java:21)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:710)atjavax.servlet.http.HttpServlet.service(HttpServlet.java:803)atorg.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)atorg.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)atorg.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)atorg.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)atorg.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)atorg.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)atorg.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)atorg.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)atorg.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)atorg.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)atorg.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)atjava.lang.Thread.run(UnknownSource)
解决方案
解决方案二:
lz需要说明一下你的空指针是在什么情况下出的错,光贴了一些错误代码,无法回答呀!呵呵
解决方案三:
连接成功java.lang.NullPointerExceptionatcom.blog.toolsBean.JDBConnection.getStm(JDBConnection.java:40)这里的错。你的连接成功估计是个假相,连接根本就不成功,要不怎么取不到statement呢?好好看下代码。看下你的jdbcurl、user、pwd、端口等是否都正确,
解决方案四:
NullPointerException都告诉你了嘛~去找吧~LIST,SET,STRING之类的,慢慢找~单步跟踪吧
解决方案五:
atcom.blog.dao.ConsumerDao.getConsumerForm(ConsumerDao.java:90)atcom.blog.servlet.ConsumerServlet.registerConsumer(ConsumerServlet.java:76)atcom.blog.servlet.ConsumerServlet.doPost(ConsumerServlet.java:21)
把这三行错误中设计到的对象在控制台输出,确定下是不是对象的值为空。为空连接出错.