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

Struts2.2 with jdk9 throws exceptions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.2.1
    • 2.2.3
    • Core
    • None

    Description

      The test case struts2example.war use struts-core 2.2.1 and xwork2.2.1. It
      works with jdk8 & struts 2.2.1. But when we build the war with jdk9 and deploy the war to tomcat9 or jetty9.3 with JAVA_HOME=

      {jdk9_b141_home}

      . The deployment got exceptions:
      1) JDK9_b141 tomcat9:

          01-Nov-2016 11:21:38.641 SEVERE [http-nio-8080-exec-6] com.opensymphony.xwork2.util.logging.jdk.JdkLogger.error Dispatcher initialization failed
       java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
      	at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:295)
      	at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:431)
      	at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)
      	at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)
      	at com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93)
      	at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487)
      	at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484)
      	at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)
      	at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484)
      	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:252)
      	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:193)
      	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
      	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:371)
      	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:415)
      	at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
      	at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
      	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
      	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
      	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
      	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4579)
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5225)
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
      	at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1316)
      	at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:669)
      	at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:217)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:232)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:105)
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:618)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
      	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1078)
      	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
      	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:760)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1524)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.reflect.InvocationTargetException
      	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 com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:293)
      	... 53 more
      Caused by: java.lang.ExceptionInInitializerError
      	at com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:85)
      	... 58 more
      Caused by: java.lang.IllegalArgumentException: Javassist library is missing in classpath! Please add missed dependency!
      	at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:165)
      	... 59 more
      Caused by: java.lang.ClassNotFoundException: javassist.ClassPool
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1311)
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1145)
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Class.java:259)
      	at ognl.OgnlRuntime.<clinit>(OgnlRuntime.java:162)
      	... 59 more
      
      2) JDK9_b141 jetty9.3:
      java.lang.RuntimeException: Error scanning file WelcomeUserAction.class
              at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:722)
              at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:699)
              at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:699)
              at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:699)
              at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:844)
              at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
              at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)
              at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
              at java.lang.Thread.run(java.base@9-ea/Thread.java:843)
      Caused by:
      java.lang.IllegalArgumentException
              at org.objectweb.asm.ClassReader.<init>(Unknown Source)
              at org.objectweb.asm.ClassReader.<init>(Unknown Source)
              at org.objectweb.asm.ClassReader.<init>(Unknown Source)
              at org.eclipse.jetty.annotations.AnnotationParser.scanClass(AnnotationParser.java:977)
              at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:715)
              at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:699)
              at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:699)
              at org.eclipse.jetty.annotations.AnnotationParser.parseDir(AnnotationParser.java:699)
              at org.eclipse.jetty.annotations.AnnotationParser.parse(AnnotationParser.java:844)
              at org.eclipse.jetty.annotations.AnnotationConfiguration$ParserTask.call(AnnotationConfiguration.java:163)
              at org.eclipse.jetty.annotations.AnnotationConfiguration$1.run(AnnotationConfiguration.java:546)
              at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
              at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
              at java.lang.Thread.run(java.base@9-ea/Thread.java:843)
      2016-11-01 14:43:34.790:INFO:oejs.AbstractConnector:main: Started ServerConnector@7b993c65{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
      2016-11-01 14:43:34.791:INFO:oejs.Server:main: Started @1953ms
      

      It looks like the asm boundle with struts 2.2.1 does not support jdk9. Is this true? I replaced the libs of the struts2.2.1 jars with struts2.3.31 jars. The tomcat9 and jetty9.3 still throw exception.

      Could you confirm is struts2 support jdk9? If not, which version of struts support jdk9?

      Attachments

        1. struts2example.zip
          2.92 MB
          Liang ZHANG
        2. Struts2Example.war
          2.84 MB
          Liang ZHANG
        3. Struts223JDK9Example.war
          3.49 MB
          Liang ZHANG
        4. catalina.out
          32 kB
          Liang ZHANG

        Activity

          People

            Unassigned Unassigned
            liangzzhang Liang ZHANG
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: