首页 新闻 会员 周边 捐助

严重: Servlet.service() for servlet [jsp] in context with path [/Article] threw exception [An exception occurred processing [/controller/loginController.jsp] at line [15]

0
悬赏园豆:80 [已解决问题] 解决于 2017-11-20 14:34

严重: Servlet.service() for servlet [jsp] in context with path [/Article] threw exception [An exception occurred processing [/controller/loginController.jsp] at line [15]

//初始化LoginService
            LoginService loginService = new LoginService();
            //接下来判断用户名是否存在
            User user = loginService.getUser(username);
            if(user == null){
                out.print("-2");//错误码-2 :   用户名不存在!
            }else
                //如果用户名存在,那么验证用户名和密码是否匹配
                if(!username.equals(user.getUsername()) || !password.equals(user.getPassword())){
                    out.print("-3");//错误码-3 :   用户名或密码错误!
                }else{
                    //如果能到这一步,就说明用户的确存在,而且账号密码也正确。那么就把user放在session中

 

Stacktrace:] with root cause
java.lang.NullPointerException
    at util.DataBaseUtils.queryForBean(DataBaseUtils.java:237)
    at service.LoginService.getUser(LoginService.java:9)
    at org.apache.jsp.controller.loginController_jsp._jspService(loginController_jsp.java:132)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:444)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:385)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:329)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:651)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:500)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:754)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1376)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)


Z大侠的主页 Z大侠 | 初学一级 | 园豆:122
提问于:2017-11-20 12:25
< >
分享
最佳答案
0

DataBaseUtils.java的237行出现了空指针异常

收获园豆:80
dudu | 高人七级 |园豆:29737 | 2017-11-20 13:04
其他回答(1)
0

这很明显的空指针,没有值呀~

徒然喜欢你 | 园豆:1741 (小虾三级) | 2017-11-20 13:59
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册