2

我在我的 tomcat 的日志窗口中遇到异常,但我不确定错误在哪个文件中,这是日志输出

Oct 19, 2012 11:09:36 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Oct 19, 2012 11:09:36 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Oct 19, 2012 11:09:36 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
Oct 19, 2012 11:09:37 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'MACT'
Oct 19, 2012 11:09:42 AM org.apache.catalina.core.ApplicationContext log
INFO: Destroying Spring FrameworkServlet 'MACT'
Oct 19, 2012 11:09:43 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'MACT'
Oct 19, 2012 11:09:46 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [MACT] in context with path [/MACT] threw exception
java.lang.NumberFormatException: For input string: "Thu Oct 18 13"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Long.parseLong(Long.java:441)
    at java.lang.Long.parseLong(Long.java:483)
    at com.testcomp.mact.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:70)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
4

3 回答 3

2

如果您认为错误与您的编码有关,请在您的命名空间中查找该类。

在这种情况下com.testcomp.mact.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:70),对我来说,它看起来不像任何已知的框架,所以我认为它是您控制下的代码。

于 2012-10-19T16:46:02.950 回答
1

您正在尝试将包含日期值的字符串转换为长值。修改AuthorizationFilter.doFilter第 70 行以确保您传递了有效的输入parseLong调用。如果您对输入值没有任何控制权,您可以尝试以下操作

 try {
         long l = Long.parseLong(s);
         System.out.println("long l = " + l);
      } catch (NumberFormatException e) {
         log.error("NumberFormatException: " + nfe.getMessage()); 
          //Redirect your request to error page saying invalid input

      }
于 2012-10-19T17:16:46.323 回答
0

com.testcomp.mact.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:70) - 这里方法 doFilter(...) 第 70 行 .. 您正在尝试将字符串 Thu Oct 18 13 转换为 Long。所以这就是错误。

于 2012-10-19T16:49:31.217 回答