- 浏览: 7997 次
- 性别:
- 来自: 深圳
最新评论
-
wanwan108:
你好,我想问下你是通过什么方式在请求的URL上加上时间戳的?
...
STRUTS2请求加上时间戳出现java.lang.NumberFormatException
最近做的项目框架用到了struts2,经常会在日志中看到如下告警:
2011-11-25 12:54:26,975 DEBUG [com.opensymphony.xwork2.util.OgnlValueStack] - [Error setting value]
java.lang.NumberFormatException: For input string: "1322196864888"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:459)
at java.lang.Integer.valueOf(Integer.java:526)
at ognl.OgnlParserTokenManager.makeInt(OgnlParserTokenManager.java:60)
at ognl.OgnlParserTokenManager.TokenLexicalActions(OgnlParserTokenManager.java:1684)
at ognl.OgnlParserTokenManager.getNextToken(OgnlParserTokenManager.java:1519)
at ognl.OgnlParser.jj_ntk(OgnlParser.java:3079)
at ognl.OgnlParser.unaryExpression(OgnlParser.java:1081)
at ognl.OgnlParser.multiplicativeExpression(OgnlParser.java:973)
at ognl.OgnlParser.additiveExpression(OgnlParser.java:896)
at ognl.OgnlParser.shiftExpression(OgnlParser.java:752)
at ognl.OgnlParser.relationalExpression(OgnlParser.java:510)
at ognl.OgnlParser.equalityExpression(OgnlParser.java:407)
at ognl.OgnlParser.andExpression(OgnlParser.java:354)
at ognl.OgnlParser.exclusiveOrExpression(OgnlParser.java:301)
at ognl.OgnlParser.inclusiveOrExpression(OgnlParser.java:248)
at ognl.OgnlParser.logicalAndExpression(OgnlParser.java:195)
at ognl.OgnlParser.logicalOrExpression(OgnlParser.java:142)
at ognl.OgnlParser.conditionalTestExpression(OgnlParser.java:103)
at ognl.OgnlParser.assignmentExpression(OgnlParser.java:66)
at ognl.OgnlParser.expression(OgnlParser.java:25)
at ognl.OgnlParser.topLevelExpression(OgnlParser.java:17)
at ognl.Ognl.parseExpression(Ognl.java:113)
at com.opensymphony.xwork2.util.OgnlUtil.compile(OgnlUtil.java:203)
at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:158)
at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:146)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:193)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:159)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.aspire.esop.implicitLogin.filter.EsopAuthFilter.doFilter(EsopAuthFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
虽然不影响使用,但是告警比较频繁。今天跟了一下,发现是由于时间戳造成的,我们在请求后台的连接后面都会加一个时间戳,格式如下:apppath + '/query!queryproject.ajax?initStatus=1201&workOrderType=12&' + new Date().getTime()。在非struts2框架下是正常的,但是struts2就会出现如上报错。查了下资料,看到“Struts2的类型转换是基于OGNL表达式的,只要我们把HTML输入项(表单元素和其他GET/POET的参数)命名为合法的OGNL表达式,就可以充分利用Struts2的转换机制。 ”。也就是说,struts2会将符合OGNL表达式的请求自动转换,会判断是否为int型,如果是则进行int转换。时间戳就是被转换成了int型,但时间戳的长度超过了int的长度,因此报错。
这个应该算是struts的一个bug吧。
知道原因,那么就好解决了。
连接格式改为:apppath + '/query!queryproject.ajax?initStatus=1201&workOrderType=12&newTime' + new Date().getTime(),保证struts2验证不为int型即可。
2011-11-25 12:54:26,975 DEBUG [com.opensymphony.xwork2.util.OgnlValueStack] - [Error setting value]
java.lang.NumberFormatException: For input string: "1322196864888"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:459)
at java.lang.Integer.valueOf(Integer.java:526)
at ognl.OgnlParserTokenManager.makeInt(OgnlParserTokenManager.java:60)
at ognl.OgnlParserTokenManager.TokenLexicalActions(OgnlParserTokenManager.java:1684)
at ognl.OgnlParserTokenManager.getNextToken(OgnlParserTokenManager.java:1519)
at ognl.OgnlParser.jj_ntk(OgnlParser.java:3079)
at ognl.OgnlParser.unaryExpression(OgnlParser.java:1081)
at ognl.OgnlParser.multiplicativeExpression(OgnlParser.java:973)
at ognl.OgnlParser.additiveExpression(OgnlParser.java:896)
at ognl.OgnlParser.shiftExpression(OgnlParser.java:752)
at ognl.OgnlParser.relationalExpression(OgnlParser.java:510)
at ognl.OgnlParser.equalityExpression(OgnlParser.java:407)
at ognl.OgnlParser.andExpression(OgnlParser.java:354)
at ognl.OgnlParser.exclusiveOrExpression(OgnlParser.java:301)
at ognl.OgnlParser.inclusiveOrExpression(OgnlParser.java:248)
at ognl.OgnlParser.logicalAndExpression(OgnlParser.java:195)
at ognl.OgnlParser.logicalOrExpression(OgnlParser.java:142)
at ognl.OgnlParser.conditionalTestExpression(OgnlParser.java:103)
at ognl.OgnlParser.assignmentExpression(OgnlParser.java:66)
at ognl.OgnlParser.expression(OgnlParser.java:25)
at ognl.OgnlParser.topLevelExpression(OgnlParser.java:17)
at ognl.Ognl.parseExpression(Ognl.java:113)
at com.opensymphony.xwork2.util.OgnlUtil.compile(OgnlUtil.java:203)
at com.opensymphony.xwork2.util.OgnlUtil.setValue(OgnlUtil.java:186)
at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:158)
at com.opensymphony.xwork2.util.OgnlValueStack.setValue(OgnlValueStack.java:146)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:193)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:159)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:105)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:83)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:207)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:74)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:127)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:107)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:206)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:115)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:143)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:121)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:86)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:170)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:123)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:224)
at com.opensymphony.xwork2.DefaultActionInvocation$2.doProfiling(DefaultActionInvocation.java:223)
at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:221)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:50)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:504)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at com.aspire.esop.implicitLogin.filter.EsopAuthFilter.doFilter(EsopAuthFilter.java:71)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:96)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:75)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
at java.lang.Thread.run(Thread.java:595)
虽然不影响使用,但是告警比较频繁。今天跟了一下,发现是由于时间戳造成的,我们在请求后台的连接后面都会加一个时间戳,格式如下:apppath + '/query!queryproject.ajax?initStatus=1201&workOrderType=12&' + new Date().getTime()。在非struts2框架下是正常的,但是struts2就会出现如上报错。查了下资料,看到“Struts2的类型转换是基于OGNL表达式的,只要我们把HTML输入项(表单元素和其他GET/POET的参数)命名为合法的OGNL表达式,就可以充分利用Struts2的转换机制。 ”。也就是说,struts2会将符合OGNL表达式的请求自动转换,会判断是否为int型,如果是则进行int转换。时间戳就是被转换成了int型,但时间戳的长度超过了int的长度,因此报错。
这个应该算是struts的一个bug吧。
知道原因,那么就好解决了。
连接格式改为:apppath + '/query!queryproject.ajax?initStatus=1201&workOrderType=12&newTime' + new Date().getTime(),保证struts2验证不为int型即可。
发表评论
-
图片自适应TD渐变
2012-08-10 11:50 0引用文章:http://blog.csdn.net/wygyh ... -
EXT1.1 GRID删除行
2012-04-23 15:39 0这几天一直熬夜,头脑很晕.今天在实现一个EXT 1.1 GRI ... -
JSP alert样式修改
2012-03-03 14:29 0由于Ext.Msg.alert弹出会重绘demo,在多form ... -
JSP alert样式修改
2012-03-03 14:28 0由于Ext.Msg.alert弹出会重绘demo,在多form ... -
ext combobox默认展示store数据
2012-02-23 15:01 2536项目中需要用到给combobox赋初始值的问题,该初始值并不确 ... -
模态窗口关闭并刷新父页面
2011-11-19 19:03 0模态窗口关闭并刷新父页面,开始用方法 // win ... -
jsp textarea 宽度自适应
2011-11-10 20:00 0jsp textarea 宽度自适应 一般可以采用如下控制:& ... -
frame项目实战应用
2011-11-04 14:57 0frame项目实战应用 项目中需要动态加载页面。用到了fram ... -
jsp checkbox和radio级联控件.
2011-10-26 19:10 1797最近项目需要一个控件,支持动态生成chenkbox,radio ...
相关推荐
带时间戳ping命令,方便用户诊断断网的时间是什么时候,有效协作诊断网络问题。运行后生成的文件位于D盘1213.txt 文件
java获取当前时间戳的方法.pdf
GMT 0033-2014 时间戳接口规范.PDF
计算机后端-Java-Java核心基础-第21章 常用类 23. System类中获取时间戳的方法.avi
在Java编程语言中,获取当前时间戳是常见的需求,它通常用于记录操作发生的时间或进行时间相关的计算。时间戳是一个表示特定瞬间的整数,单位为毫秒,自1970年1月1日(UTC/GMT的午夜)开始所经过的毫秒数。以下是你...
例如,在Java中,我们可以使用`java.time.Instant`类的静态方法`fromEpochSecond(long epochSecond)`或`fromEpochMilli(long epochMilli)`来转换时间戳;在Python中,`datetime.datetime.fromtimestamp()`或`...
这个`windows 环境下 ping 加时间戳 记日志.rar`压缩包文件内容可能包含一个脚本或批处理文件,它扩展了基本的`ping`命令功能,增加了时间戳并记录结果到文本日志中,这样可以更方便地分析网络性能和稳定性。...
计算机后端-PHP视频教程. php与mysql加强- 03. php加强31-时间戳格式化.wmv
Unix时间戳,也被称为POSIX时间戳,是一个广泛使用的表示时间的方式,特别是在计算机编程和操作系统中。它定义为自1970年1月1日(UTC)午夜(00:00:00)以来经过的秒数,不包括闰秒。Unix时间戳在许多编程语言中被...
时间戳转换工具DCode
要从`java.util.Date`转换为`java.sql.Date`,可以调用`java.util.Date`的`getTime()`方法获取时间戳,然后用这个时间戳初始化`java.sql.Date`。相反,从`java.sql.Date`转换回`java.util.Date`,只需传入`java.sql....
在IT领域,时间戳是一种表示特定时间的方式,通常以自1970年1月1日(UTC/GMT的午夜)以来的秒数来计算。在编程中,尤其是在跨平台开发时,理解如何在不同的时间表示之间进行转换是至关重要的。在C#中,处理Unix...
Java中的`java.lang.System`类是Java核心库中不可或缺的一部分,它是系统级操作的主要入口点。这个类提供了很多静态字段和方法,用于处理系统级别的任务,如输入输出流管理、系统属性获取、时间戳获取以及资源加载等...
2. **PHP时间函数**:PHP提供了丰富的日期和时间处理函数,如`time()`用于获取当前UNIX时间戳,`strtotime()`将日期或时间字符串转换为UNIX时间戳,`date()`和`strftime()`则可以将UNIX时间戳转换为用户可读的日期和...
.NET Core时间戳格式化
而Java.sql.Date是Java.sql包中的一个类,它也是一个时间戳,但是它把当前的时间剪掉了,保证它一定是那个日期的0点0分0秒的时间戳。例如,new Java.sql.Date(new Java.util.Date().getTime())将得到当前日期的0点0...
Java 中可以使用 `System.currentTimeMillis()` 方法获取 Unix 时间戳,该方法返回当前时间的毫秒数,可以将其除以 1000 转换为秒。要将 Unix 时间戳转换为普通时间,可以使用 `SimpleDateFormat` 类。 ```java ...
易语言源码易语言时间戳源码.rar 易语言源码易语言时间戳源码.rar 易语言源码易语言时间戳源码.rar 易语言源码易语言时间戳源码.rar 易语言源码易语言时间戳源码.rar 易语言源码易语言时间戳源码.rar易语言源码...
Linux中文件时间戳的概念、类型和底层结构是基于Ext2/3/4文件系统的。Ext2文件系统是Linux操作系统中最常用的文件系统之一,Ext3和Ext4是其后继版本。这些文件系统中都有着不同的时间戳机制。 在Linux操作系统中,...