0

I am trying to configure a slave for my jenkins Master. I did the below steps.

  1. enabled passwordless auth to remote host(GNU LINUX)
  2. Configured the slave on master

I can see the slave.jar being copied to remote host folder. But it is failing with the below error

Expanded the channel window size to 4MB
  [11/07/14 19:11:54] [SSH] Starting slave process: cd "/test/app/abc/slavetest" && /usr/java        /jdk1.6.0_29 -XX:MaxPermSize=2048m -Xmx2048m -jar slave.jar
  bash: /usr/java/jdk1.6.0_29: is a directory
  hudson.util.IOException2: Slave JVM has terminated. Exit code=126
    at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:953)
    at hudson.plugins.sshslaves.SSHLauncher.access$400(SSHLauncher.java:133)
    at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:711)
    at hudson.plugins.sshslaves.SSHLauncher$2.call(SSHLauncher.java:696)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
  Caused by: java.io.EOFException: unexpected stream termination
    at hudson.remoting.ChannelBuilder.negotiate(ChannelBuilder.java:200)
    at hudson.remoting.Channel.<init>(Channel.java:419)
    at hudson.remoting.Channel.<init>(Channel.java:398)
    at hudson.remoting.Channel.<init>(Channel.java:394)
    at hudson.remoting.Channel.<init>(Channel.java:383)
    at hudson.remoting.Channel.<init>(Channel.java:375)
    at hudson.slaves.SlaveComputer.setChannel(SlaveComputer.java:344)
    at hudson.plugins.sshslaves.SSHLauncher.startSlave(SSHLauncher.java:945)
    ... 7 more  
  [11/07/14 19:11:54] Launch failed - cleaning up connection
  [11/07/14 19:11:54] [SSH] Connection closed.

Any idea what I am doing wrong?

Upen
  • 1,388
  • 1
  • 22
  • 49
  • Possible duplicate: http://stackoverflow.com/questions/8523749/jenkins-slave-environment-variable-refresh – guido Nov 07 '14 at 19:25
  • thanks for the pointer. But for me i had fixed the issue with jdk. – Upen Nov 07 '14 at 19:30

2 Answers2

3

You have your slave's path to the java executable misconfigured:

/usr/java        /jdk1.6.0_29 -XX:MaxPermSize=2048m -Xmx2048m -jar slave.jar

The blank space should be removed, and the full path should be

/usr/java/jdk1.6.0_29/bin/java 
gareth_bowles
  • 20,760
  • 5
  • 52
  • 82
  • I corrected the spaces. Same error - [11/07/14 21:44:51] [SSH] Starting slave process: cd "/test/app/slavetest" && /usr/java/jdk1.6.0_29 -jar slave.jar bash: /usr/java/jdk1.6.0_29: is a directory – Upen Nov 07 '14 at 21:46
  • Fixed the issue. Installed a jdk under the slave folder on the remote host. test/app/slavetest/jdk. Modified the slave configuration in Jenkins>manage nodes to point java to this folder. Thanks for all the help – Upen Nov 07 '14 at 22:31
  • Click the Advanced button under the Launch Method section of the slave configuration and make sure JavaPath is set to /usr/java/jdk1.6.0_29/bin/java. It has to be the full path to the executable, not the JAVA_HOME location. – gareth_bowles Nov 07 '14 at 22:31
1

I just ran into this as well. Best to check the docker container/slave's java path by logging into the container and running whereis java.

The java path of the host and agent are probably not the same. And that jar and the java command is being executed from within the agent.