大家帮忙看看这个错误时怎抹回事
我是使用的书上的实例,打开网页后,按了注册,就出现了以下错误,我用的是mysql数据库
HTTP Status 500 -
--------------------------------------------
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535) org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException bit.jeffy.action.RegisterAction.execute(RegisterAction.java:199)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
------解决方案--------------------谁会有时间这么帮下载下来,再打开,再找错误呢?楼主学习不能用这样的态度
------解决方案--------------------数据库连接出来异常
DataStore.java
=================================================================
private DataStore() throws Exception {
if (conn == null) {
Class.forName( "com.mysql.jdbc.Driver ");
conn = DriverManager.getConnection( "jdbc:mysql://localhost:3306/netfile ", "root ",
"harmony ");
stmt = conn.createStatement();
}
}
========================================================================
你用的数据库是mysql不假,有驱动吗?数据库是netfile吗?用户是root吗?密码是harmony吗?
估计将就是这地方出错了,你看一下吧
你报的
空指针是RegisterAction.java195行的 ds,这个ds可能是个null,就是DataStore.getInstance();给你返回了null,你跟踪一下这个ds吧
DataStore ds = DataStore.getInstance();
------解决方案--------------------LZ
V38说的还是比较实在的了 确实应该自己解决问题的
我也没下你的程序也是属于不实在的。但看上面留言和你包错信息
java.lang.
NullPointerException 通常是某个对象的引用出现问题 要么是为NULL要不就是没有加载全
bit.jeffy.action.RegisterAction.execute(RegisterAction.java:199)这个报错很明显的 bit.jeffy.action包中的RegisterAction.java 中199行附近(报错不一定准确的 可能在上一行也可能在下一行)有NULL的对象引用。
我的异常网推荐解决方案:The server encountered an internal error () that prevented it from fulfilling this request.,http://www.aiyiweb.com/java-w