After the upgrade from Jenkins 1.515 to Jenkins 1.518 one of our Maven projects failed due to a ClassFormatException:
23:13:30 [JENKINS] Archiving site from /export/build/jenkins-slave/workspace/xxx-nightly-trunk/target/site to /export/build/jenkins/jobs/xxx-nightly-trunk/site
23:13:37 java.lang.reflect.InvocationTargetException
23:13:37 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
23:13:37 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
23:13:37 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
23:13:37 at java.lang.reflect.Method.invoke(Method.java:592)
23:13:37 at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
23:13:37 at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
23:13:37 at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
23:13:37 at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
23:13:37 at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
23:13:37 at hudson.remoting.UserRequest.perform(UserRequest.java:118)
23:13:37 at hudson.remoting.UserRequest.perform(UserRequest.java:48)
23:13:37 at hudson.remoting.Request$2.run(Request.java:326)
23:13:37 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
23:13:37 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
23:13:37 at java.util.concurrent.FutureTask.run(FutureTask.java:123)
23:13:37 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:651)
23:13:37 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:676)
23:13:37 at java.lang.Thread.run(Thread.java:595)
23:13:37 Caused by: java.lang.ClassFormatError: Failed to load jnr.ffi.mapper.FunctionMapper
23:13:37 at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:193)
23:13:37 at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:144)
23:13:37 at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
23:13:37 at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
23:13:37 at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
23:13:37 at hudson.os.PosixAPI.jnr(PosixAPI.java:30)
23:13:37 at hudson.util.IOUtils.mode(IOUtils.java:125)
23:13:37 at hudson.util.io.TarArchiver.visit(TarArchiver.java:102)
23:13:37 at hudson.util.DirScanner$Glob.scan(DirScanner.java:133)
23:13:37 at hudson.FilePath.writeToTar(FilePath.java:1979)
23:13:37 at hudson.FilePath.copyRecursiveTo(FilePath.java:1905)
23:13:37 at hudson.FilePath.copyRecursiveTo(FilePath.java:1832)
23:13:37 at hudson.maven.reporters.MavenSiteArchiver.postExecute(MavenSiteArchiver.java:82)
23:13:37 at hudson.maven.Maven3Builder$MavenExecutionListener.recordMojoEnded(Maven3Builder.java:453)
23:13:37 at hudson.maven.Maven3Builder$MavenExecutionListener.mojoSucceeded(Maven3Builder.java:435)
23:13:37 at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:87)
23:13:37 at org.apache.maven.lifecycle.internal.DefaultExecutionEventCatapult.fire(DefaultExecutionEventCatapult.java:42)
23:13:37 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:228)
23:13:37 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
23:13:37 at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
23:13:37 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
23:13:37 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
23:13:37 at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
23:13:37 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
23:13:37 at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
23:13:37 at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
23:13:37 at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
23:13:37 ... 18 more
23:13:37 Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file
23:13:37 at java.lang.ClassLoader.defineClass1(Native Method)
23:13:37 at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
23:13:37 at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
23:13:37 at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:191)
23:13:37 ... 44 more
23:13:37 channel stopped
23:13:38 ERROR: Failed to parse POMs
The issue can be found in the call stack:
The Jenkins slave calls the Maven launcher and and the Maven launcher does a callback into the Jenkins code to perform some IO operations. For those operations, the jnr-ffi library is used and this has been compiled on the 8th of June under OpenJDK 6 and under Oracle JDK 7:
https://travis-ci.org/jnr/jnr-ffi
The pom.xml of the library has no compiler plugin configuration and thus creates code for whatever JDK it runs on (Java 6 class version 50) and I assume that this new version of the library has been pulled in between 1.516 and 1.518 of Jenkins.
That means this new version of the jnr-ffi library drops Java 5 support for certain Maven builds.