问题描述
在执行登录的时候tomcat报错:不知道是什么原因[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | dnsguard[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | login.jsp[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(145) | user login[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | dnsguard[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | login.jsp[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(145) | user login[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(48) | loginAction.do[DNSGuard] DEBUG [http-8080-1] Permessionfilter.doFilter(145) | user login[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select status from users where username ='admin' and pwd = md5('11111111')[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryForList(417) | select logintime from nta_log.login_log where account='admin' and onlogin=1 AND logflag=1 and latelyip <>2130706433[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | SELECT selectedID FROM nta_conf.permission_group_list t1, dns_web.users t2 WHERE username='admin' and t1.id = t2.group_id[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select level from dns_web.menu where nodeid=1[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select level from dns_web.menu where nodeid=2[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select level from dns_web.menu where nodeid=3[DNSGuard] DEBUG [http-8080-1] BaseDAO.queryRowSet(262) | select level from dns_web.menu where nodeid=4[DNSGuard] DEBUG [http-8080-1] ActionExceptionHandler.execute(59) | java.lang.NumberFormatException: For input string: ",1,2,3,4,"at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)at java.lang.Integer.parseInt(Integer.java:447)at java.lang.Integer.parseInt(Integer.java:497)at com.risinginfo.nta.common.login.action.LoginAction.login(LoginAction.java:92)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:597)at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:280)at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:216)at org.springframework.web.struts.DelegatingActionProxy.execute(DelegatingActionProxy.java:106)at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:75)at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at com.risinginfo.nta.common.filter.Permessionfilter.doFilter(Permessionfilter.java:155)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at com.risinginfo.nta.common.jcaptcha.JCaptchaFilter.doFilter(JCaptchaFilter.java:91)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:861)at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:579)at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1584)at java.lang.Thread.run(Thread.java:619) public String getPermissionGroupID(String username) { String sql = "SELECT selectedID FROM nta_conf.permission_group_list t1, dns_web.users t2 "; sql += " WHERE username='" + username + "'"; sql += " and t1.id = t2.group_id"; SqlRowSet rowSet = queryRowSet(sql); String menu_id = ","; if(rowSet.next()) { String menu_id_tmp = rowSet.getString("selectedID"); String[] menuArr = menu_id_tmp.split(","); for(int i = 0; i < menuArr.length; i++) { String nodeid = menuArr[i]; menu_id += nodeid + ","; String parSql = "select level from dns_web.menu where nodeid=" + nodeid; SqlRowSet rowSet2 = queryRowSet(parSql); if(rowSet2.next()) { int level = rowSet2.getInt(1); for(int k = level - 1; k > 0; k--){ //4级 String parSql2 = "select parentid from dns_web.menu where nodeid=" + nodeid; SqlRowSet rowSet3 = queryRowSet(parSql2); if(rowSet3.next()){ String parentid = rowSet3.getString(1); menu_id += parentid + ","; nodeid = parentid; } } } } } return menu_id; }
解决方案
LoginAction 92行 无法把数字类型的数据放入String当中。应该是类型转换的时候 忽略了。你找找。
解决方案二:
LoginAction.java:92LoginAction的92行,报了NumberFormatException你是不是把什么不能转成数字的东西转数字了可能是int level = rowSet2.getInt(1); 这个地方
解决方案三:
能具体点吗? 为什么总贴这么一大堆代码