在将应用程序从JBOSS5迁移到JBOSS6期间,我不得不将Struts2 2.1.8更新为2.3.24
当我收到此异常时,应用程序现在正常工作,除了一个页面:
Servlet.service() for servlet JspSupportServlet threw exception: java.lang.ArrayIndexOutOfBoundsException: -1
at com.opensymphony.module.sitemesh.html.HTMLProcessor$1.currentBuffer(HTMLProcessor.java:74) [sitemesh-2.4.2.jar:]
at com.opensymphony.module.sitemesh.html.State.handleText(State.java:64) [sitemesh-2.4.2.jar:]
at com.opensymphony.module.sitemesh.html.HTMLProcessor$2.text(HTMLProcessor.java:103) [sitemesh-2.4.2.jar:]
at com.opensymphony.module.sitemesh.html.tokenizer.Parser.parsedText(Parser.java:295) [sitemesh-2.4.2.jar:]
at com.opensymphony.module.sitemesh.html.tokenizer.Parser.parseTag(Parser.java:160) [sitemesh-2.4.2.jar:]
at com.opensymphony.module.sitemesh.html.tokenizer.Parser.start(Parser.java:112) [sitemesh-2.4.2.jar:]
at com.opensymphony.module.sitemesh.html.tokenizer.TagTokenizer.start(TagTokenizer.java:33) [sitemesh-2.4.2.jar:]
at com.opensymphony.module.sitemesh.html.HTMLProcessor.process(HTMLProcessor.java:90) [sitemesh-2.4.2.jar:]
at com.opensymphony.module.sitemesh.parser.HTMLPageParser.parse(HTMLPageParser.java:52) [sitemesh-2.4.2.jar:]
at com.opensymphony.sitemesh.compatability.PageParser2ContentProcessor.build(PageParser2ContentProcessor.java:51) [sitemesh-2.4.2.jar:]
at com.opensymphony.sitemesh.webapp.ContentBufferingResponse.getContent(ContentBufferingResponse.java:54) [sitemesh-2.4.2.jar:]
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:137) [sitemesh-2.4.2.jar:]
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77) [sitemesh-2.4.2.jar:]
.......
10:34:49,800 INFO [org.springframework.ldap.core.LdapTemplate] (http-/10.136.115.166:8080-6) The returnObjFlag of supplied SearchControls is not set but a ContextMapper is used - setting flag to true
10:34:49,992 ERROR [freemarker.runtime] (http-/10.136.115.166:8080-6) Error executing FreeMarker template: freemarker.core._MiscTemplateException: Failed to "?eval" string with this error:
---begin-message---
Invalid reference. Details are unavilable, as this should have been handled by an FTL construct. If it wasn't, that's problably a bug in FreeMarker.
---end-message---
The failing expression:
==> action_property?eval [in template "WEB-INF/content/common/controls/radio.ftl" at line 3, column 78]
----
FTL stack trace ("~" means nesting-related):
- Failed at: #if ((action_property?eval)!"") == value [in template "WEB-INF/content/common/controls/radio.ftl" in macro "display" at line 3, column 71]
- Reached through: @radio.display action_property="ccdSe... [in template "WEB-INF/content/common/ccd_search_fields.ftl" in macro "display" at line 21, column 21]
- Reached through: @ccd_search_fields.display [in template "WEB-INF/content/search-ccd.ftl" at line 25, column 5]
----
at freemarker.core.BuiltInsForStringsMisc$evalBI.calculateResult(BuiltInsForStringsMisc.java:76) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.BuiltInForString._eval(BuiltInForString.java:26) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Expression.eval(Expression.java:78) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.ParentheticalExpression._eval(ParentheticalExpression.java:44) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Expression.eval(Expression.java:78) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.DefaultToExpression._eval(DefaultToExpression.java:73) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Expression.eval(Expression.java:78) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.ParentheticalExpression._eval(ParentheticalExpression.java:44) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Expression.eval(Expression.java:78) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.EvalUtil.compare(EvalUtil.java:110) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.ComparisonExpression.evalToBoolean(ComparisonExpression.java:64) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:46) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visit(Environment.java:312) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.MixedContent.accept(MixedContent.java:62) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visitByHiddingParent(Environment.java:333) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:159) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visitIteratorBlock(Environment.java:559) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:67) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visit(Environment.java:312) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.MixedContent.accept(MixedContent.java:62) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visit(Environment.java:312) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Macro$Context.runMacro(Macro.java:178) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.invoke(Environment.java:700) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visit(Environment.java:312) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.MixedContent.accept(MixedContent.java:62) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visit(Environment.java:312) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Macro$Context.runMacro(Macro.java:178) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.invoke(Environment.java:700) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:84) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visit(Environment.java:312) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.MixedContent.accept(MixedContent.java:62) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visitByHiddingParent(Environment.java:333) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visitAndTransform(Environment.java:413) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.UnifiedCall.accept(UnifiedCall.java:108) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visit(Environment.java:312) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.MixedContent.accept(MixedContent.java:62) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.visit(Environment.java:312) [freemarker-2.3.22.jar:2.3.22]
at freemarker.core.Environment.process(Environment.java:290) [freemarker-2.3.22.jar:2.3.22]
at freemarker.template.Template.process(Template.java:312) [freemarker-2.3.22.jar:2.3.22]
at org.apache.struts2.views.freemarker.FreemarkerResult.doExecute(FreemarkerResult.java:223) [struts2-core-2.3.24.jar:2.3.24]
at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:191) [struts2-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:369) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:273) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) [xwork-core-2.3.24.jar:2.3.24]
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:76) [struts2-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:229) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91) [struts2-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:253) [struts2-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104) [struts2-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256) [struts2-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) [struts2-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.roche.cdi2.web.interceptors.CdiExceptionInterceptor.intercept(CdiExceptionInterceptor.java:21) [classes:]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189) [xwork-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at org.apache.struts2.interceptor.MessageStoreInterceptor.intercept(MessageStoreInterceptor.java:197) [struts2-core-2.3.24.jar:2.3.24]
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:244) [xwork-core-2.3.24.jar:2.3.24]
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) [struts2-core-2.3.24.jar:2.3.24]
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:564) [struts2-core-2.3.24.jar:2.3.24]
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:81) [struts2-core-2.3.24.jar:2.3.24]
at org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter.doFilter(StrutsExecuteFilter.java:93) [struts2-core-2.3.24.jar:2.3.24]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.17.Final-redhat-1-JBPAPP6-1709.jar:]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.17.Final-redhat-1-JBPAPP6-1709.jar:]
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129) [sitemesh-2.4.2.jar:]
at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77) [sitemesh-2.4.2.jar:]
........
我发现这个问题很常见,但我无法找到解决方案。
这是我的依赖树:
[INFO] +- org.apache.struts:struts2-core:jar:2.3.24:compile
[INFO] | +- org.apache.struts.xwork:xwork-core:jar:2.3.24:compile
[INFO] | | \- asm:asm-commons:jar:3.3:compile
[INFO] | | \- asm:asm-tree:jar:3.3:compile
[INFO] | +- org.freemarker:freemarker:jar:2.3.22:compile
[INFO] | +- ognl:ognl:jar:3.0.6:compile
[INFO] | | \- javassist:javassist:jar:3.11.0.GA:compile
[INFO] | +- commons-fileupload:commons-fileupload:jar:1.3.1:compile
[INFO] | \- commons-io:commons-io:jar:2.2:compile
[INFO] +- org.apache.struts:struts2-spring-plugin:jar:2.3.24:compile
[INFO] | \- org.apache.commons:commons-lang3:jar:3.2:compile
[INFO] +- org.apache.struts:struts2-sitemesh-plugin:jar:2.3.24:compile
[INFO] | \- opensymphony:sitemesh:jar:2.4.2:compile
[INFO] +- org.apache.struts:struts2-convention-plugin:jar:2.3.24:compile
错误指向该文件:
<#macro display action_property values=[] label_keys=[] item_list="" vertical_display=false disabled=false>
<#list values as value>
<input type="radio" name="${action_property}" value="${value}"<#if ((action_property?eval)!'') == value> checked="checked"</#if><#if disabled> disabled="true"</#if>/> <@s.text name="${label_keys[value_index]}"/>
<#if vertical_display><br /></#if>
</#list>
<#if item_list?has_content>
<#list item_list?eval as radioItem>
<input type="radio" name="${action_property}" value="${radioItem.code}"<#if ((action_property?eval)!'') == radioItem.code> checked="checked"</#if><#if disabled> disabled="true"</#if>/> ${radioItem.name}
<#if vertical_display><br /></#if>
</#list>
</#if>
</#macro>