严重: Servlet.service() for servlet [jsp] in context with path [/prj_web] threw exception [An exception occurred processing JSP page /registerset.jsp at line 58
55: try{ //娣诲姞鐢ㄦ埛淇伅
56:
57: String addUser="INSERT INTO user(userid,username,password,name,company,address,sex,interest) VALUES(null,?,?,?,?,?,?,?)";
58: pstmt=conn.prepareStatement(addUser); //棰勫鐞?
59: //璁剧疆鍙傛暟
60: pstmt.setString(1,reqUsername);
61: pstmt.setString(2,reqPassword);
Stacktrace:] with root cause
java.lang.NullPointerException
at org.apache.jsp.registerset_jsp._jspService(registerset_jsp.java:154)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:431)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
不知道哪出问题了,跪求大神指点
4 个解决方案
#1
你的conn
可能是null ,
在查询之前,看看你的conn是否为null值,如果是 则改
可能是null ,
在查询之前,看看你的conn是否为null值,如果是 则改
#2
已经是null了,但是一运行就指向语句
pstmt=conn.prepareStatement(addUser);
不知道是为何
pstmt=conn.prepareStatement(addUser);
不知道是为何
#3
都已经是Null了还不改?conn的url password user 你都配了?
#4
已经解决了,是数据库密码安装时没设,不过还是要谢谢!
#1
你的conn
可能是null ,
在查询之前,看看你的conn是否为null值,如果是 则改
可能是null ,
在查询之前,看看你的conn是否为null值,如果是 则改
#2
已经是null了,但是一运行就指向语句
pstmt=conn.prepareStatement(addUser);
不知道是为何
pstmt=conn.prepareStatement(addUser);
不知道是为何
#3
都已经是Null了还不改?conn的url password user 你都配了?
#4
已经解决了,是数据库密码安装时没设,不过还是要谢谢!