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

Exception starting filter struts2 java.lang.IncompatibleClassChangeError: Implementing class

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Not A Problem
    • Affects Version/s: 2.3.28
    • Fix Version/s: 2.3.31
    • Component/s: Dispatch Filter
    • Labels:
      None
    • Environment:

      Ubuntu 16.04 LTS, JDK 7, Tomcat 8

      Description

      My code compiles fine and my app deploys to Tomcat 8 but I'm getting the following error in my Tomcat localhost log when the app attempts to start. Any ideas on how to resolve this (or even how to get further debug info for where the issue is)?

      I have enabled FINE logging on the localhost log and found several other filters starting with no exceptions (see below updated log output). Why is the struts2 filter specifically having issues and all of these other filters aren't?

      Also as a test, I commented out the struts2 filter (org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter for me) and the application installs and starts with no issues. So, the problem is certainly localized to the struts2 filter.

      from my tomcat localhost log...

      13-Jul-2016 16:22:34.847 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.listenerStart Sending application start events
      13-Jul-2016 16:22:35.225 INFO [http-nio-8080-exec-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
      13-Jul-2016 16:22:36.224 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStart Starting filters
      13-Jul-2016 16:22:36.224 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStart  Starting filter 'ApplicationInitFilter'
      13-Jul-2016 16:22:53.465 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStart  Starting filter 'monitoring'
      13-Jul-2016 16:22:53.846 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStart  Starting filter 'Tomcat WebSocket (JSR356) Filter'
      13-Jul-2016 16:22:53.846 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStart  Starting filter 'springSecurityFilterChain'
      13-Jul-2016 16:22:53.848 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStart  Starting filter 'javamelody'
      13-Jul-2016 16:22:53.848 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStart  Starting filter 'struts2'
      13-Jul-2016 16:22:54.534 SEVERE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStart Exception starting filter struts2
       java.lang.IncompatibleClassChangeError: Implementing class
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2541)
      	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:858)
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1301)
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
      	at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2541)
      	at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:858)
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1301)
      	at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1166)
      	at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildClassFinder(PackageBasedActionConfigBuilder.java:416)
      	at org.apache.struts2.convention.PackageBasedActionConfigBuilder.findActions(PackageBasedActionConfigBuilder.java:397)
      	at org.apache.struts2.convention.PackageBasedActionConfigBuilder.buildActionConfigs(PackageBasedActionConfigBuilder.java:354)
      	at org.apache.struts2.convention.ClasspathPackageProvider.loadPackages(ClasspathPackageProvider.java:53)
      	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:274)
      	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:67)
      	at org.apache.struts2.dispatcher.Dispatcher.getContainer(Dispatcher.java:970)
      	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:438)
      	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:482)
      	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.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:4689)
      	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5329)
      	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
      	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)
      	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)
      	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
      	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1092)
      	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:473)
      	at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1612)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:606)
      	at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
      	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      	at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
      	at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1451)
      	at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:897)
      	at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:335)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
      	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
      	at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
      	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
      	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
      	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
      	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
      	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)
      	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
      	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
      	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
      	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
      	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099)
      	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
      	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      	at java.lang.Thread.run(Thread.java:745)
      
      13-Jul-2016 16:22:54.541 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStop Stopping filters
      13-Jul-2016 16:22:54.541 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStop  Stopping filter 'ApplicationInitFilter'
      13-Jul-2016 16:22:54.564 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStop  Stopping filter 'monitoring'
      13-Jul-2016 16:22:54.781 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStop  Stopping filter 'Tomcat WebSocket (JSR356) Filter'
      13-Jul-2016 16:22:54.781 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStop  Stopping filter 'javamelody'
      13-Jul-2016 16:22:54.781 FINE [http-nio-8080-exec-1] org.apache.catalina.core.StandardContext.filterStop  Stopping filter 'springSecurityFilterChain'
      13-Jul-2016 16:22:54.781 INFO [http-nio-8080-exec-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
      

        Activity

        Hide
        lukaszlenart Lukasz Lenart added a comment -

        Thanks for reporting back!

        Show
        lukaszlenart Lukasz Lenart added a comment - Thanks for reporting back!
        Hide
        zack.macomber@gmail.com Zack Macomber added a comment -

        Unbelievable...it appears renaming that com.ibm jar to start with "ws..." causes everything to work fine, from ant compile to tomcat deploy...it appears that class loading is alphabetical in the WEB-INF/lib dir (at least for now)...what a headache...closing this issue...

        Show
        zack.macomber@gmail.com Zack Macomber added a comment - Unbelievable...it appears renaming that com.ibm jar to start with "ws..." causes everything to work fine, from ant compile to tomcat deploy...it appears that class loading is alphabetical in the WEB-INF/lib dir (at least for now)...what a headache...closing this issue...
        Hide
        zack.macomber@gmail.com Zack Macomber added a comment -

        I found the issue jar - com.ibm.ws.admin.client_8.5.0.jar. This jar is an uber jar that contains a bunch of org.apache classes in it. Leave it up to IBM to corrupt everything! Guess I'll have to figure out how to resolve jar conflicts now...

        Show
        zack.macomber@gmail.com Zack Macomber added a comment - I found the issue jar - com.ibm.ws.admin.client_8.5.0.jar. This jar is an uber jar that contains a bunch of org.apache classes in it. Leave it up to IBM to corrupt everything! Guess I'll have to figure out how to resolve jar conflicts now...
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        It's better to use Maven to handle dependencies or use Essential Dependencies Only from the download page http://struts.apache.org/download.cgi#struts251

        But in your case it must be something else as you are using the Convention Plugin and it tries to scan all classes in the classpath to find actions and one of the classes was compiled with JDK8 probably.

        Show
        lukaszlenart Lukasz Lenart added a comment - It's better to use Maven to handle dependencies or use Essential Dependencies Only from the download page http://struts.apache.org/download.cgi#struts251 But in your case it must be something else as you are using the Convention Plugin and it tries to scan all classes in the classpath to find actions and one of the classes was compiled with JDK8 probably.
        Hide
        zack.macomber@gmail.com Zack Macomber added a comment -

        Thanks Lukasz - as far as you know, are the following the only jars needed for struts 2 (found at https://struts.apache.org/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.html)

        asm-x.x.jar
        asm-commons-x.x.jar
        asm-tree-x.x.jar
        commons-io-X.X.X.jar
        commons-lang3-X.X.X.jar
        commons-fileupload-X.X.X.jar
        freemarker-X.X.X.jar
        javassist-X.X.X.jar
        ognl-X.X.X.jar
        struts2-core-X.X.X.X.jar
        xwork-core-X.X.X.jar

        Show
        zack.macomber@gmail.com Zack Macomber added a comment - Thanks Lukasz - as far as you know, are the following the only jars needed for struts 2 (found at https://struts.apache.org/docs/create-struts-2-web-application-with-artifacts-in-web-inf-lib-and-use-ant-to-build-the-application.html ) asm-x.x.jar asm-commons-x.x.jar asm-tree-x.x.jar commons-io-X.X.X.jar commons-lang3-X.X.X.jar commons-fileupload-X.X.X.jar freemarker-X.X.X.jar javassist-X.X.X.jar ognl-X.X.X.jar struts2-core-X.X.X.X.jar xwork-core-X.X.X.jar
        Hide
        lukaszlenart Lukasz Lenart added a comment -

        You must have a jar compiled with JDK8 as you are running on JDK7 - please review jars in WEB-INF/lib

        Show
        lukaszlenart Lukasz Lenart added a comment - You must have a jar compiled with JDK8 as you are running on JDK7 - please review jars in WEB-INF/lib

          People

          • Assignee:
            Unassigned
            Reporter:
            zack.macomber@gmail.com Zack Macomber
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development