我在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)
答案 0 :(得分:2)
如果您认为错误与编码有关,请在命名空间中查找该类。
在这种情况下,com.testcomp.mact.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:70)
对我来说看起来不是任何已知的框架,所以我认为它是您控制下的代码。
答案 1 :(得分:1)
您正在尝试将String包含的日期值转换为Long值。在第70行修改AuthorizationFilter.doFilter
以确保您传递有效的输入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
}
答案 2 :(得分:0)
com.testcomp.mact.web.filter.AuthorizationFilter.doFilter(AuthorizationFilter.java:70) - 这里方法doFilter(...)行号70 ..你试图转换字符串Thu Oct 18 13到龙。这就是错误。