我使用带有Convention插件的Struts 2。 Struts 2依赖于ASM 3.3,它与Java 8不兼容。 它无法发现包含lambda或方法引用的动作类。
例外:
2014-06-27 18:47:32,958 ERROR main/com.opensymphony.xwork2.util.finder.ClassFinder: Unable to read class [my.project.Action]
java.lang.ArrayIndexOutOfBoundsException: 30305
at org.objectweb.asm.ClassReader.readClass(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.opensymphony.xwork2.util.finder.ClassFinder.readClassDef(ClassFinder.java:717)
at com.opensymphony.xwork2.util.finder.ClassFinder.<init>(ClassFinder.java:112)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:390)
at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:347)
at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:268)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:445)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:489)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:57)
ASM 5似乎支持Java 8,但Struts与之不兼容。
这个问题是否有解决方法?现在我正在考虑修补Struts / XWork。