Jenkins配置节点报错:bash: /root/.jenkins/jdk/bin/java: 没有那个文件或目录

在这里插入图片描述

SSHLauncher{host='192.168.111.129', port=22, credentialsId='aa9fc1b1-ccc2-470f-a612-f20e32b55dea', jvmOptions='', javaPath='', prefixStartSlaveCmd='', suffixStartSlaveCmd='', launchTimeoutSeconds=60, maxNumRetries=10, retryWaitTime=15, sshHostKeyVerificationStrategy=hudson.plugins.sshslaves.verifiers.KnownHostsFileKeyVerificationStrategy, tcpNoDelay=true, trackCredentials=true}
[01/05/22 17:34:03] [SSH] Opening SSH connection to 192.168.111.129:22.
Searching for 192.168.111.129 in /root/.ssh/known_hosts
Searching for 192.168.111.129:22 in /root/.ssh/known_hosts
[01/05/22 17:34:03] [SSH] SSH host key matches key in Known Hosts file. Connection will be allowed.
[01/05/22 17:34:03] [SSH] 认证成功。
[01/05/22 17:34:04] [SSH] The remote user's environment is:
BASH=/usr/bin/bash
BASHOPTS=cmdhist:extquote:force_fignore:hostcomplete:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSINFO=([0]="4" [1]="2" [2]="46" [3]="2" [4]="release" [5]="x86_64-redhat-linux-gnu")
BASH_VERSION='4.2.46(2)-release'
DIRSTACK=()
EUID=0
GROUPS=()
HOME=/root
HOSTNAME=bogon
HOSTTYPE=x86_64
ID=0
IFS=$' \t\n'
LANG=zh_CN.UTF-8
LESSOPEN='||/usr/bin/lesspipe.sh %s'
LOGNAME=root
MACHTYPE=x86_64-redhat-linux-gnu
MAIL=/var/mail/root
OPTERR=1
OPTIND=1
OSTYPE=linux-gnu
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin
PIPESTATUS=([0]="0")
PPID=5436
PS4='+ '
PWD=/root
SELINUX_LEVEL_REQUESTED=
SELINUX_ROLE_REQUESTED=
SELINUX_USE_CURRENT_RANGE=
SHELL=/bin/bash
SHELLOPTS=braceexpand:hashall:interactive-comments
SHLVL=1
SSH_CLIENT='192.168.111.129 37138 22'
SSH_CONNECTION='192.168.111.129 37138 192.168.111.129 22'
TERM=dumb
UID=0
USER=root
XDG_RUNTIME_DIR=/run/user/0
XDG_SESSION_ID=25
_=/etc/bashrc
[01/05/22 17:34:04] [SSH] Checking java version of /root/.jenkins/jdk/bin/java
Couldn't figure out the Java version of /root/.jenkins/jdk/bin/java
bash: /root/.jenkins/jdk/bin/java: 没有那个文件或目录

[01/05/22 17:34:04] [SSH] Checking java version of java
Couldn't figure out the Java version of java
bash: java: 未找到命令

[01/05/22 17:34:04] [SSH] Checking java version of /usr/bin/java
Couldn't figure out the Java version of /usr/bin/java
bash: /usr/bin/java: 没有那个文件或目录

[01/05/22 17:34:04] [SSH] Checking java version of /usr/java/default/bin/java
Couldn't figure out the Java version of /usr/java/default/bin/java
bash: /usr/java/default/bin/java: 没有那个文件或目录

[01/05/22 17:34:04] [SSH] Checking java version of /usr/java/latest/bin/java
Couldn't figure out the Java version of /usr/java/latest/bin/java
bash: /usr/java/latest/bin/java: 没有那个文件或目录

[01/05/22 17:34:04] [SSH] Checking java version of /usr/local/bin/java
Couldn't figure out the Java version of /usr/local/bin/java
bash: /usr/local/bin/java: 没有那个文件或目录

[01/05/22 17:34:04] [SSH] Checking java version of /usr/local/java/bin/java
Couldn't figure out the Java version of /usr/local/java/bin/java
bash: /usr/local/java/bin/java: 没有那个文件或目录

java.io.IOException: Java not found on hudson.slaves.SlaveComputer@331d1385. Install a Java 8 version on the Agent.
	at hudson.plugins.sshslaves.JavaVersionChecker.resolveJava(JavaVersionChecker.java:89)
	at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:454)
	at hudson.plugins.sshslaves.SSHLauncher$1.call(SSHLauncher.java:423)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
[01/05/22 17:34:04] Launch failed - cleaning up connection
[01/05/22 17:34:04] [SSH] 连接关闭。

解决办法一:
在Slave机上找到java命令目录,配置在节点上
在这里插入图片描述
解决办法二:建立软连接

cd /root/.jenkins/
mkdir jdk
cd jdk/
mkdir bin
cd bin/
ln -s /usr/local/jdk1.8.0_231/bin/java /root/.jenkins/jdk/bin/java
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐