Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4431

Java 8 support - lambda in action classes

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.3.16.3
    • Fix Version/s: 2.5
    • Component/s: Core Actions
    • Labels:
    • Environment:

      Jdk 1.8

      Description

      When there is any lamba expression placed inside of action class, during startup struts is presenting error like below:

      com.opensymphony.xwork2.util.logging.commons.CommonsLogger error
      SEVERE: Unable to read class [com.ppp.elsevier.struts.action.admin.spa.bannerBox.SampleAction]
      java.lang.ArrayIndexOutOfBoundsException: 10572
      	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)
      	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:298)
      	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:119)
      	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4076)
      	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4730)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      	at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)
      	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
      	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
      	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
      	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
      	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
      	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
      

      After this exception application is starting normally but SampleAction is not configured and not accessible.

      If lambda expression is removed from action class (i.e. the lambda is moved to non action class and referenced from inside action), all is working without problems.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                lukaszlenart Lukasz Lenart
                Reporter:
                poulwiel PaweĊ‚ Wielgus
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: