Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-27947

JDK 1.6 maven builds fail when running on Tomcat 8

    Details

    • Similar Issues:

      Description

      This seems to be a duplicate of JENKINS-16920, but a newer iteration. Due to the recent talk on the mailing list about removing 1.6 support, as well as the git plugin dropping 1.6 support, we decided to upgrade our Jenkins from running on Java 6/Tomcat 6 to Java 7/Tomcat 8. However, it appears Tomcat 8 ships a version of servlet-api built with Java 7. Jessie's original analysis on why this was a problem is here: https://issues.jenkins-ci.org/browse/JENKINS-16920?focusedCommentId=174350&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-174350
      I suspect this is either the same or a very similar issue.

      Here is the stack trace:

      java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
      	at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:121)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:49)
      	at hudson.remoting.Request$2.run(Request.java:324)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.ClassFormatError: Failed to load javax.servlet.ServletException
      	at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:325)
      	at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:237)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      	at hudson.ExtensionList.lookup(ExtensionList.java:350)
      	at hudson.FilePath.actAsync(FilePath.java:1046)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:2070)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:2013)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:1996)
      	at hudson.maven.reporters.AbstractMavenJavadocArchiver.postExecute(AbstractMavenJavadocArchiver.java:98)
      	at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:628)
      	at hudson.maven.Maven3Builder$MavenExecutionListener.mojoSucceeded(Maven3Builder.java:610)
      	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:87)
      	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:228)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      	at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
      	... 22 more
      Caused by: java.lang.UnsupportedClassVersionError: javax/servlet/ServletException : Unsupported major.minor version 51.0
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
      	at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:323)
      	... 45 more
      ERROR: Failed to parse POMs
      hudson.util.IOException2: java.lang.reflect.InvocationTargetException
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:178)
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:121)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:49)
      	at hudson.remoting.Request$2.run(Request.java:324)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:662)
      	at ......remote call to Channel to Maven [D:\j\tools\hudson.model.JDK\JDK_1.6_26/bin/java, -Xms512m, -Xmx1024m, -XX:PermSize=128m, -XX:MaxPermSize=256m, -cp, D:\j\maven3-agent.jar;D:\j\tools\hudson.tasks.Maven_MavenInstallation\maven-3.0.5\boot\plexus-classworlds-2.4.jar, org.jvnet.hudson.maven3.agent.Maven3Main, D:\j\tools\hudson.tasks.Maven_MavenInstallation\maven-3.0.5, D:\j\slave.jar, D:\j\maven3-interceptor.jar, D:\j\maven3-interceptor-commons.jar, 53213](Native Method)
      	at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1356)
      	at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
      	at hudson.remoting.Channel.call(Channel.java:752)
      	at hudson.maven.ProcessCache$MavenProcess.call(ProcessCache.java:160)
      	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:843)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
      	at hudson.model.Run.execute(Run.java:1745)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
      	at hudson.model.ResourceController.execute(ResourceController.java:89)
      	at hudson.model.Executor.run(Executor.java:240)
      Caused by: java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
      	at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:121)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:49)
      	at hudson.remoting.Request$2.run(Request.java:324)
      	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
      	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      	at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.Exception: java.lang.reflect.InvocationTargetException
      	at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:181)
      	... 15 more
      Caused by: java.lang.reflect.InvocationTargetException
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
      	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
      	at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:178)
      	... 15 more
      Caused by: java.lang.ClassFormatError: Failed to load javax.servlet.ServletException
      	at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:325)
      	at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:237)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      	at hudson.ExtensionList.lookup(ExtensionList.java:350)
      	at hudson.FilePath.actAsync(FilePath.java:1046)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:2070)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:2013)
      	at hudson.FilePath.copyRecursiveTo(FilePath.java:1996)
      	at hudson.maven.reporters.AbstractMavenJavadocArchiver.postExecute(AbstractMavenJavadocArchiver.java:98)
      	at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:628)
      	at hudson.maven.Maven3Builder$MavenExecutionListener.mojoSucceeded(Maven3Builder.java:610)
      	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:87)
      	at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:228)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
      	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
      	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
      	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
      	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
      	at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:117)
      	... 22 more
      Caused by: java.lang.UnsupportedClassVersionError: javax/servlet/ServletException : Unsupported major.minor version 51.0
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:465)
      	at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:323)
      	... 45 more
      

        Attachments

          Issue Links

            Activity

            Hide
            danielbeck Daniel Beck added a comment -
            Show
            danielbeck Daniel Beck added a comment - JENKINS-25272 ?
            Hide
            pmv pmv added a comment -

            I think these tickets are similar, in that users running builds expect to be able to compile with any JDK. However, the actual criteria seems to be this:

            If you are building using the Maven project type, the minimum JDK you can compile with is determined by the maximum of the following:

            1. The java version Jenkins core was compiled with
            2. The java version your container was compiled with (specifically, the servlet-api jar)
            3. The java version the maven-plugin was compiled with

            The versions for JENKINS-25272 are 1.6, 1.5, 1.5, so a 1.5 build broke due to be #1 (as I would consider the remoting jar to be part of core)
            The versions for JENKINS-16920 were 1.5, 1.6, 1.5, so a 1.5 build broke due to #2.
            The versions for this ticket are 1.6, 1.7, 1.5, so 1.6 builds break due to #2.

            We haven't actually seen #3, since it seems to be lagging behind the other two, but I suspect it is true.

            These restrictions make some sense once you understand that Jenkins plugin classloading is hierarchical (rather than using something like OSGi), so plugin developers probably understand this: https://wiki.jenkins-ci.org/display/JENKINS/Plugin+Structure#PluginStructure-Classloader However, the first time you encounter it as a user it's not intuitive (especially the servlet-api dependency).

            If a fix is not going to be made, at minimum I would suggest calling out these restrictions on the Maven project plugin wiki page: https://wiki.jenkins-ci.org/display/JENKINS/Maven+Project+Plugin

            Show
            pmv pmv added a comment - I think these tickets are similar, in that users running builds expect to be able to compile with any JDK. However, the actual criteria seems to be this: If you are building using the Maven project type , the minimum JDK you can compile with is determined by the maximum of the following: The java version Jenkins core was compiled with The java version your container was compiled with (specifically, the servlet-api jar) The java version the maven-plugin was compiled with The versions for JENKINS-25272 are 1.6, 1.5, 1.5, so a 1.5 build broke due to be #1 (as I would consider the remoting jar to be part of core) The versions for JENKINS-16920 were 1.5, 1.6, 1.5, so a 1.5 build broke due to #2. The versions for this ticket are 1.6, 1.7, 1.5, so 1.6 builds break due to #2. We haven't actually seen #3, since it seems to be lagging behind the other two, but I suspect it is true. These restrictions make some sense once you understand that Jenkins plugin classloading is hierarchical (rather than using something like OSGi), so plugin developers probably understand this: https://wiki.jenkins-ci.org/display/JENKINS/Plugin+Structure#PluginStructure-Classloader However, the first time you encounter it as a user it's not intuitive (especially the servlet-api dependency). If a fix is not going to be made, at minimum I would suggest calling out these restrictions on the Maven project plugin wiki page: https://wiki.jenkins-ci.org/display/JENKINS/Maven+Project+Plugin
            Hide
            jglick Jesse Glick added a comment -

            Essentially a duplicate of JENKINS-25272.

            (BTW the Jenkins class loaders are in fact modular, as in OSGi. The problem here is that the slave agent shares code with the master, and the Maven plugin runs some of that same code also in the Maven process. It is just a foolish design.)

            Show
            jglick Jesse Glick added a comment - Essentially a duplicate of JENKINS-25272 . (BTW the Jenkins class loaders are in fact modular, as in OSGi. The problem here is that the slave agent shares code with the master, and the Maven plugin runs some of that same code also in the Maven process. It is just a foolish design.)

              People

              • Assignee:
                Unassigned
                Reporter:
                pmv pmv
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: