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: 

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(
 at java.lang.ClassLoader.defineClass(
 at hudson.remoting.RemoteClassLoader.loadClassFile(
 at hudson.remoting.RemoteClassLoader.findClass(
 at java.lang.ClassLoader.loadClass(
 at java.lang.ClassLoader.loadClass(
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(
 at hudson.remoting.MultiClassLoaderSerializer$Input.resolveClass(
 at hudson.remoting.UserRequest.deserialize(
 at hudson.remoting.UserRequest.perform(
 at hudson.remoting.UserRequest.perform(
 at hudson.remoting.Request$
 at hudson.remoting.InterceptingExecutorService$
 at java.util.concurrent.FutureTask$Sync.innerRun(
 at java.util.concurrent.ThreadPoolExecutor.runWorker(
 at java.util.concurrent.ThreadPoolExecutor$
[09/21/15 13:34:57] Launch failed - cleaning up connection
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: