用Java做一个登陆页面,但找不到SQLyog数据库的user_id,但数据库是有这一列的?

2019-06-01 10:24:25 connection:537 INFO - 5. Connection opened
2019-06-01 10:24:25 audit:162 INFO - 5. Connection.new Connection returned
2019-06-01 10:24:25 audit:162 INFO - 5. PreparedStatement.new PreparedStatement returned
2019-06-01 10:24:25 audit:162 INFO - 5. Connection.prepareStatement(SELECT * FROM users WHERE user_name=?) returned net.sf.log4jdbc.PreparedStatementSpy@5b66e37d
2019-06-01 10:24:25 audit:162 INFO - 5. PreparedStatement.setString(1, "1") returned
2019-06-01 10:24:25.659 com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:36)
5. SELECT * FROM users WHERE user_name='1'

2019-06-01 10:24:25 sqltiming:370 INFO - SELECT * FROM users WHERE user_name='1'
{executed in 1 msec}
2019-06-01 10:24:25.660 5. ResultSet.new ResultSet returned

2019-06-01 10:24:25 resultset:162 INFO - 5. ResultSet.new ResultSet returned
2019-06-01 10:24:25 audit:162 INFO - 5. PreparedStatement.executeQuery() returned net.sf.log4jdbc.ResultSetSpy@3fe1526c
2019-06-01 10:24:25.661 5. ResultSet.next() returned true

2019-06-01 10:24:25 resultset:162 INFO - 5. ResultSet.next() returned true
2019-06-01 10:24:25 audit:104 ERROR - 5. ResultSet.getInt(user_id)
java.sql.SQLException: Column 'user_id' not found.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1166)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2850)
at net.sf.log4jdbc.ResultSetSpy.getInt(ResultSetSpy.java:1463)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:39)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:1)
at com.gx.service.impl.UsersServiceImpl.login(UsersServiceImpl.java:86)
at com.gx.servlet.LoginServlet.userLogin(LoginServlet.java:100)
at com.gx.servlet.LoginServlet.doPost(LoginServlet.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.AjaxEncodeFilter.doFilter(AjaxEncodeFilter.java:34)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.LogFilter.doFilter(LogFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
2019-06-01 10:24:25.662 5. ResultSet.getInt(user_id)

java.sql.SQLException: Column 'user_id' not found.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1166)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2850)
at net.sf.log4jdbc.ResultSetSpy.getInt(ResultSetSpy.java:1463)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:39)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:1)
at com.gx.service.impl.UsersServiceImpl.login(UsersServiceImpl.java:86)
at com.gx.servlet.LoginServlet.userLogin(LoginServlet.java:100)
at com.gx.servlet.LoginServlet.doPost(LoginServlet.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.AjaxEncodeFilter.doFilter(AjaxEncodeFilter.java:34)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.LogFilter.doFilter(LogFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
2019-06-01 10:24:25 sqlonly:105 ERROR - 5. ResultSet.getInt(user_id)
java.sql.SQLException: Column 'user_id' not found.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1166)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2850)
at net.sf.log4jdbc.ResultSetSpy.getInt(ResultSetSpy.java:1463)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:39)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:1)
at com.gx.service.impl.UsersServiceImpl.login(UsersServiceImpl.java:86)
at com.gx.servlet.LoginServlet.userLogin(LoginServlet.java:100)
at com.gx.servlet.LoginServlet.doPost(LoginServlet.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.AjaxEncodeFilter.doFilter(AjaxEncodeFilter.java:34)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.LogFilter.doFilter(LogFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
2019-06-01 10:24:25 sqltiming:106 ERROR - 5. ResultSet.getInt(user_id)
java.sql.SQLException: Column 'user_id' not found.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1166)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2850)
at net.sf.log4jdbc.ResultSetSpy.getInt(ResultSetSpy.java:1463)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:39)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:1)
at com.gx.service.impl.UsersServiceImpl.login(UsersServiceImpl.java:86)
at com.gx.servlet.LoginServlet.userLogin(LoginServlet.java:100)
at com.gx.servlet.LoginServlet.doPost(LoginServlet.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.AjaxEncodeFilter.doFilter(AjaxEncodeFilter.java:34)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:43)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.LogFilter.doFilter(LogFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
java.sql.SQLException: Column 'user_id' not found.
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:988)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:974)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
at com.mysql.jdbc.ResultSetImpl.findColumn(ResultSetImpl.java:1166)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2850)
at net.sf.log4jdbc.ResultSetSpy.getInt(ResultSetSpy.java:1463)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:39)
at com.gx.dao.impl.UsersDaoImpl.findByName(UsersDaoImpl.java:1)
at com.gx.service.impl.UsersServiceImpl.login(UsersServiceImpl.java:86)
at com.gx.servlet.LoginServlet.userLogin(LoginServlet.java:100)
at com.gx.servlet.LoginServlet.doPost(LoginServlet.java:49)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:646)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.AjaxEncodeFilter.doFilter(AjaxEncodeFilter.java:34)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:43)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at com.gx.filter.LogFilter.doFilter(LogFilter.java:83)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

2019-06-01 10:24:25 connection:556 INFO - 5. Connection closed
2019-06-01 10:24:25 audit:162 INFO - 5. Connection.close() returned
2019-06-01 10:24:25 audit:162 INFO - 5. PreparedStatement.close() returned
2019-06-01 10:24:25.670 5. ResultSet.close() returned

2019-06-01 10:24:25 resultset:162 INFO - 5. ResultSet.close() returned
{"state":false,"msg":"账户或者密码错误"}
2019-06-01 10:24:25 LogFilter:86 INFO - 0:0:0:0:0:0:0:1 POST方式 Servlet[loginServlet], 总用时 34 毫秒。
图片说明
图片说明

2个回答

遇到这样的问题,先检查user_id是否一模一样,如果一样还是错误,通过getInt(1)数字的方式打印内容的信息,在做判断

我记得是没有的,你重新看一下是不是哪里忘记了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问