Monday, September 21, 2015

Jenkins - Unable to launch slave machine

Have you upgraded your jenkins to 1.6+ and unable to launch slave agents.
You might need to read this blog.
 
SSH Slaves Plugin / slaves.jar requires JDK 1.7

 
Upgrading Jenkins to 1.6+ doesn't allow Java version < 7. 
Refer Blog: http://jenkins-ci.org/content/good-bye-java6 

Due to which Jenkins failed to launch slave using SSH.

You might have received some error like below:

Caused by: java.lang.UnsupportedClassVersionError: hudson/slaves/SlaveComputer$SlaveVersion : Unsupported major.minor version 51.0
 at java.lang.ClassLoader.defineClass1(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:480)
 at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:338)
 at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:251)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:264)
 at hudson.remoting.MultiClassLoaderSerializer$Input.resolveClass(MultiClassLoaderSerializer.java:113)
 at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1592)
 at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1513)
 at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1749)
 at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1346)
 at java.io.ObjectInputStream.readObject(ObjectInputStream.java:368)
 at hudson.remoting.UserRequest.deserialize(UserRequest.java:185)
 at hudson.remoting.UserRequest.perform(UserRequest.java:99)
 at hudson.remoting.UserRequest.perform(UserRequest.java:49)
 at hudson.remoting.Request$2.run(Request.java:326)
 at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
 at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
 at java.util.concurrent.FutureTask.run(FutureTask.java:166)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
 at java.lang.Thread.run(Thread.java:679)
[09/21/15 13:34:57] Launch failed - cleaning up connection
 
Solution: 
Log on to slave machine manually:
  1. Download Java JDK 1.7 and extract it on home directory
  2. Goto Jenkins Portal
  3. Goto Manage your Node page
  4. Goto "Advanced" settings under "Launch method" section
  5. specify JavaPath to Java7 directory of remote(slave) machine
    e.g /home/{user}/jdk1.7.0_79/bin/java
  6. Relaunch Slave Agent
JavaPath is the important property that you're looking for fix, shown in the image below:



1 comment:

Moot said...

Thanks for the hint!