首页 index.jsp 页面报错
Error:java.lang.NullPointerException
后台登录完报错为
HTTP Status 500 - An exception occurred processing JSP page /admin/sys/loginpost.jsp at line 28
type Exception report
message An exception occurred processing JSP page /admin/sys/loginpost.jsp at line 28
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 /admin/sys/loginpost.jsp at line 28
25: String lang = Request.GetString("lang", "chinese"); 26: 27: UserLogin userLogin = new UserLogin(dbo, session, "AdminLogin", request); 28: if(userLogin.Login(name, password, 1)) 29: { 30: WebInit.Init_Lang = lang;//chinese english 31: response.sendRedirect("/admin/main.html");
Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:568) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause
java.lang.NullPointerException com.NJD.db.DBO.ExecuteQuery(wd:171) com.NJD.db.mysql.MySQL5_5.GetRecordsNum(bd:219) com.NJD.ums.basic.UserDb.Exist(cc:198) com.NJD.ums.UserLogin.Login(wb:193) org.apache.jsp.admin.sys.loginpost_jsp._jspService(loginpost_jsp.java:94) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
1
zjw60320 2017-01-06 13:40:07 +08:00
空指针,看一下 /admin/sys/loginpost.jsp at line 28 这里有什么问题
|
2
holyghost 2017-01-06 13:41:48 +08:00
不是大神,不懂 java ,但是难道不应该去看看 28: if(userLogin.Login(name, password, 1)) 哪里可能会 NPE 吗?
(一个猜想不一定对 |
3
Melissa OP @zjw60320 感觉这个地方没有什么问题啊~~
<% DBO dbo = new DB().getDbo(); dbo.setRequest(request); //DBO dbo = new MySQL5_5(WebInit.Init_DefaultDB); RequestHandle Request = new RequestHandle(request); String htmlStr = ""; String name = Request.GetString("user", true); String password = Request.GetString("pwd", true); String code = Request.GetString("code"); String lang = Request.GetString("lang", "chinese"); UserLogin userLogin = new UserLogin(dbo, session, "AdminLogin", request); if(userLogin.Login(name, password, 1)) { WebInit.Init_Lang = lang;//chinese english response.sendRedirect("/admin/main.html"); } else { htmlStr = "<script>"; htmlStr += "ReturnError('"+ userLogin.getErrorMsg() +"');"; htmlStr += "</script>"; out.print(htmlStr); } dbo.CloseAll(); %> |
4
wanglv110 2017-01-06 15:07:39 +08:00 1
在 28 行输出一下看看 userLogin 是不是为 null
|
5
acoder2013 2017-01-07 18:39:27 +08:00
喜闻乐见的 NPE 。。。
|
6
Miy4mori 2017-01-07 19:59:36 +08:00
你就是单步一下也找到问题了啊,既然是 RuntimeException 就要运行时排查,手动〇〇
|
7
Melissa OP @Miy4mori 现在发现是一个时间判断问题,,在连接数据库之前会有一个时间判断,(应该是判断当前时间是否和数据库的当前时间一直,),然后我没有源码,,只有相关的 jar 文件,,求大神告知有没有好的办法解决? 比如修改服务器的时间可以么?
|
8
Melissa OP @acoder2013 我承认自己菜鸟满意了嘛~~
|
10
skywayman 2017-01-08 22:24:38 +08:00 1
建议方案: 1.用 winrar 打开 jar 包 ; 2.找到 class 拖出来反编译为 java ; 3.加上一堆 out 输出查看变量 4.重新把 java 再编译为 class 使用 winrar 放到 jar 中 run. good luck.
|
11
dallaslu 2017-01-08 23:43:55 +08:00 1
第一直觉应该看 com.NJD.db.DBO.ExecuteQuery(wd:171) 这里。如果已经定位到时间判断,可以改时间试试,因为可能只是验证了时间差。还是反编译吧,靠谱。
|