Hey community,

      after the last upgrade (I guess it was from Jenkins 1.551) to Jenkins 1.584 we encounter serious problems with our legacy Java5 Maven builds.
      When Jenkins calls the Maven plugin (right after "Parsing poms") the build crashes with the following stacktrace:

      Parsing POMs
      Modules changed, recalculating dependency graph
      [my-maven-project] $ /var/apphome/162_cipbld/jdk_1.5_latest/bin/java -Xms64m -Xmx256m -XX:PermSize=64m -XX:MaxPermSize=256m -cp /var/apphome/162_cipbld/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.5.jar:/var/apphome/162_cipbld/apache-maven-3.0.4/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /var/apphome/162_cipbld/apache-maven-3.0.4 /var/apphome/162_cipbld/162_cipbld-0/webapps/jenkins/WEB-INF/lib/remoting-2.46.jar /var/apphome/162_cipbld/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.5.jar /var/apphome/162_cipbld/.jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.5.jar 58566
      Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
      	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
      	at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
      	at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
      	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:386)
      	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:42)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
      	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
      	at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:135)
      	at org.jvnet.hudson.maven3.agent.Maven3Main.main(Maven3Main.java:64)
      [EnvInject] - Injecting environment variables from a build step.
      [EnvInject] - Injecting as environment variables the properties file path '/path/to/my.properties'
      [EnvInject] - Variables injected successfully.
      ERROR: Failed to parse POMs
      java.net.SocketException: Connection reset
      	at java.net.SocketInputStream.read(SocketInputStream.java:168)
      	at java.io.FilterInputStream.read(FilterInputStream.java:116)
      	at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
      	at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
      	at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:198)
      	at hudson.remoting.Channel.<init>(Channel.java:418)
      	at hudson.remoting.Channel.<init>(Channel.java:397)
      	at hudson.remoting.Channel.<init>(Channel.java:393)
      	at hudson.remoting.Channel.<init>(Channel.java:382)
      	at hudson.remoting.Channel.<init>(Channel.java:374)
      	at hudson.remoting.Channel.<init>(Channel.java:366)
      	at hudson.slaves.Channels$1.<init>(Channels.java:70)
      	at hudson.slaves.Channels.forProcess(Channels.java:70)
      	at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:280)
      	at hudson.maven.ProcessCache.get(ProcessCache.java:235)
      	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:759)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
      	at hudson.model.Run.execute(Run.java:1754)
      	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:529)
      	at hudson.model.ResourceController.execute(ResourceController.java:89)
      	at hudson.model.Executor.run(Executor.java:240)
      Email was triggered for: Failure - Any
      

      I figured out that the only difference between succeeding and failing builds was the version of remoting.jar. The new Jenkins version ships with version 2.46. When I stopped Tomcat and exchanged the remoting-2.46.jar with remoting-2.44.jar the builds work again.

      Could you please investigate this as it is crucial to us that the Java5 builds are still stable to build?

      Thanks!

          [JENKINS-25272] remoting-2.46.jar breaks JDK 5 Maven builds

          Thanks for the feedback. Actually I even use a IBM JDK to get the 'correct' compile results, so I don't think using a different compiler version and checking the used API is sufficient here.

          The problem in setting the JDK environment during the build is that normally the JDKs are managed by Jenkins and not by the Build Job, so it is not easy to know the correct JAVA_HOME (especially on a not jet selected build node) to be set. Your fix solved this in a elegant way (IMHO). It looks that for some reason your switching magic does not kick in or kicks in to late.

          Andreas Mandel added a comment - Thanks for the feedback. Actually I even use a IBM JDK to get the 'correct' compile results, so I don't think using a different compiler version and checking the used API is sufficient here. The problem in setting the JDK environment during the build is that normally the JDKs are managed by Jenkins and not by the Build Job, so it is not easy to know the correct JAVA_HOME (especially on a not jet selected build node) to be set. Your fix solved this in a elegant way (IMHO). It looks that for some reason your switching magic does not kick in or kicks in to late.

          Jesse Glick added a comment -

          it is not easy to know the correct JAVA_HOME

          I think you can just use something like $JDK_5_HOME from the Maven goals field after defining such a variable using the Tool Env plugin. But yes it would be good to get the automatic switch working again.

          Jesse Glick added a comment - it is not easy to know the correct JAVA_HOME I think you can just use something like $JDK_5_HOME from the Maven goals field after defining such a variable using the Tool Env plugin. But yes it would be good to get the automatic switch working again.

          Unfortunatelly I got stuck at the same Error Message too.
          As Java 6 introduces incompatible changes in the JDBC API, we have JDK 1.5 jobs using the Maven Project plugin and the m2release plugin.

          Fortunatelly there are only a few jobs left and I will try to force development to get rid of this usage, but nevertheless at the moment its a blocker to move beyond Jenkins LTS 1.565.2

          The workaround to set something like $JDK_5_HOME, how is this working, because in the Jenkins Maven Project Job Config I still would need to use JDK 1.6+, wouldn't I?

          Florian Rosenauer added a comment - Unfortunatelly I got stuck at the same Error Message too. As Java 6 introduces incompatible changes in the JDBC API, we have JDK 1.5 jobs using the Maven Project plugin and the m2release plugin. Fortunatelly there are only a few jobs left and I will try to force development to get rid of this usage, but nevertheless at the moment its a blocker to move beyond Jenkins LTS 1.565.2 The workaround to set something like $JDK_5_HOME, how is this working, because in the Jenkins Maven Project Job Config I still would need to use JDK 1.6+, wouldn't I?

          Jesse Glick added a comment -

          The workaround to set something like $JDK_5_HOME, how is this working

          Again, using something like the Tool Env plugin.

          Jesse Glick added a comment - The workaround to set something like $JDK_5_HOME, how is this working Again, using something like the Tool Env plugin.

          Jesse Glick added a comment -

          Attaching sample project which will compile under JDK 5, but not JDK 8. Useful as a test case.

          Jesse Glick added a comment - Attaching sample project which will compile under JDK 5, but not JDK 8. Useful as a test case.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/maven/AbstractMavenProcessFactory.java
          http://jenkins-ci.org/commit/maven-plugin/0913aa1f42f004786ea9b34b8cdfdbd9aa8dc4d6
          Log:
          [FIXED JENKINS-25272] Extend JENKINS-18403 workaround for newer remoting.jar built with -target 6.
          Also handle a SocketException in Channels.forProcess, arising because Maven31Main tries to load remoting classes and fails.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/maven/AbstractMavenProcessFactory.java http://jenkins-ci.org/commit/maven-plugin/0913aa1f42f004786ea9b34b8cdfdbd9aa8dc4d6 Log: [FIXED JENKINS-25272] Extend JENKINS-18403 workaround for newer remoting.jar built with -target 6. Also handle a SocketException in Channels.forProcess, arising because Maven31Main tries to load remoting classes and fails.

          Code changed in jenkins
          User: Jesse Glick
          Path:
          src/main/java/hudson/maven/AbstractMavenProcessFactory.java
          http://jenkins-ci.org/commit/maven-plugin/c88577a3d56b0968eacb118bd3adb7ea35914a19
          Log:
          Merge pull request #49 from jglick/remoting-class-version-JENKINS-25272

          JENKINS-25272 Extend JENKINS-18403 workaround for newer remoting.jar

          Compare: https://github.com/jenkinsci/maven-plugin/compare/02ca06095f8f...c88577a3d56b

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/hudson/maven/AbstractMavenProcessFactory.java http://jenkins-ci.org/commit/maven-plugin/c88577a3d56b0968eacb118bd3adb7ea35914a19 Log: Merge pull request #49 from jglick/remoting-class-version- JENKINS-25272 JENKINS-25272 Extend JENKINS-18403 workaround for newer remoting.jar Compare: https://github.com/jenkinsci/maven-plugin/compare/02ca06095f8f...c88577a3d56b

          Will that PR be merged into the LTS branch very soon? Pretty please?

          Steffen Breitbach added a comment - Will that PR be merged into the LTS branch very soon? Pretty please?

          Jesse Glick added a comment -

          This is plugin, not core. Just update it.

          Jesse Glick added a comment - This is plugin, not core. Just update it.

          youssef alami added a comment -

          Hey community,

          i used jenkins 1.532.2 and we encountered serious problems with our legacy Java5 Maven builds, after i upgrade to Jenkins 1.580.1. and i have the same problem.
          When Jenkins calls the Maven plugin (right after "Parsing poms") the build crashes with the following stacktrace:
          Parsing POMs
          maven-agent.jar already up to date
          classworlds.jar already up to date
          maven-interceptor.jar already up to date
          maven2.1-interceptor.jar already up to date
          [my_mvn_project] $ /cip/opt/jdk1.5.0_22/bin/java -Xmx1024M -XX:PermSize=128M -XX:MaxPermSize=512M -cp /cip/home/jenkins-V1/maven-agent.jar:/cip/home/jenkins-V1/classworlds.jar hudson.maven.agent.Main /cip/opt/apache-maven-2.2.1 /cip/home/jenkins-V1/slave.jar /cip/home/jenkins-V1/maven-interceptor.jar 60645 /cip/home/jenkins-V1/maven2.1-interceptor.jar
          Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
          at java.lang.ClassLoader.defineClass1(Native Method)
          at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
          at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
          at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
          at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
          at java.security.AccessController.doPrivileged(Native Method)
          at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
          at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
          at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195)
          at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255)
          at hudson.maven.agent.Main.main(Main.java:143)
          at hudson.maven.agent.Main.main(Main.java:68)
          ERROR: Failed to parse POMs
          java.net.SocketException: Connection reset
          at java.net.SocketInputStream.read(SocketInputStream.java:168)
          at java.io.FilterInputStream.read(FilterInputStream.java:116)
          at hudson.remoting.ProxyInputStream$Buffer.read(ProxyInputStream.java:110)
          at hudson.remoting.ProxyInputStream$Chunk.perform(ProxyInputStream.java:132)
          at hudson.remoting.ProxyInputStream$Chunk.perform(ProxyInputStream.java:119)
          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 FRASCIPSLAVE-1(Native Method)
          at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1356)
          at hudson.remoting.Request.call(Request.java:171)
          at hudson.remoting.ProxyInputStream._read(ProxyInputStream.java:74)
          at hudson.remoting.ProxyInputStream.read(ProxyInputStream.java:80)
          at hudson.remoting.RemoteInputStream.read(RemoteInputStream.java:269)
          at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
          at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
          at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
          at java.io.BufferedInputStream.read(BufferedInputStream.java:237)
          at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:329)
          at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:280)
          at hudson.slaves.Channels.forProcess(Channels.java:114)
          at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:253)
          at hudson.maven.ProcessCache.get(ProcessCache.java:236)
          at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:749)
          at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
          at hudson.model.Run.execute(Run.java:1745)
          at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)
          at hudson.model.ResourceController.execute(ResourceController.java:89)
          at hudson.model.Executor.run(Executor.java:240)
          Finished: FAILURE

          thank you in advance for your help !

          youssef alami added a comment - Hey community, i used jenkins 1.532.2 and we encountered serious problems with our legacy Java5 Maven builds, after i upgrade to Jenkins 1.580.1. and i have the same problem. When Jenkins calls the Maven plugin (right after "Parsing poms") the build crashes with the following stacktrace: Parsing POMs maven-agent.jar already up to date classworlds.jar already up to date maven-interceptor.jar already up to date maven2.1-interceptor.jar already up to date [my_mvn_project] $ /cip/opt/jdk1.5.0_22/bin/java -Xmx1024M -XX:PermSize=128M -XX:MaxPermSize=512M -cp /cip/home/jenkins-V1/maven-agent.jar:/cip/home/jenkins-V1/classworlds.jar hudson.maven.agent.Main /cip/opt/apache-maven-2.2.1 /cip/home/jenkins-V1/slave.jar /cip/home/jenkins-V1/maven-interceptor.jar 60645 /cip/home/jenkins-V1/maven2.1-interceptor.jar Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassLoader.java:195) at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassRealm.java:255) at hudson.maven.agent.Main.main(Main.java:143) at hudson.maven.agent.Main.main(Main.java:68) ERROR: Failed to parse POMs java.net.SocketException: Connection reset at java.net.SocketInputStream.read(SocketInputStream.java:168) at java.io.FilterInputStream.read(FilterInputStream.java:116) at hudson.remoting.ProxyInputStream$Buffer.read(ProxyInputStream.java:110) at hudson.remoting.ProxyInputStream$Chunk.perform(ProxyInputStream.java:132) at hudson.remoting.ProxyInputStream$Chunk.perform(ProxyInputStream.java:119) 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 FRASCIPSLAVE-1(Native Method) at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1356) at hudson.remoting.Request.call(Request.java:171) at hudson.remoting.ProxyInputStream._read(ProxyInputStream.java:74) at hudson.remoting.ProxyInputStream.read(ProxyInputStream.java:80) at hudson.remoting.RemoteInputStream.read(RemoteInputStream.java:269) at java.io.BufferedInputStream.read1(BufferedInputStream.java:256) at java.io.BufferedInputStream.read(BufferedInputStream.java:317) at java.io.BufferedInputStream.fill(BufferedInputStream.java:218) at java.io.BufferedInputStream.read(BufferedInputStream.java:237) at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:329) at hudson.remoting.ChannelBuilder.build(ChannelBuilder.java:280) at hudson.slaves.Channels.forProcess(Channels.java:114) at hudson.maven.AbstractMavenProcessFactory.newProcess(AbstractMavenProcessFactory.java:253) at hudson.maven.ProcessCache.get(ProcessCache.java:236) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:749) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533) at hudson.model.Run.execute(Run.java:1745) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) Finished: FAILURE thank you in advance for your help !

            jglick Jesse Glick
            chemiker Stefan Strobel
            Votes:
            6 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: