jenkins启动失败 jenkins.service failed Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录

失败的原因

● jenkins.service - LSB: Jenkins Automation Server
   Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
   Active: failed (Result: exit-code) since 二 2020-05-19 20:40:51 CST; 3min 27s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1880 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)

5月 19 20:40:50 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...
5月 19 20:40:51 localhost.localdomain runuser[1885]: pam_unix(runuser:session): session opened for user root by (uid=0)
5月 19 20:40:51 localhost.localdomain jenkins[1880]: Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录
5月 19 20:40:51 localhost.localdomain systemd[1]: jenkins.service: control process exited, code=exited status=1
5月 19 20:40:51 localhost.localdomain jenkins[1880]: [失败]
5月 19 20:40:51 localhost.localdomain systemd[1]: Failed to start LSB: Jenkins Automation Server.
5月 19 20:40:51 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
5月 19 20:40:51 localhost.localdomain systemd[1]: jenkins.service failed.

解决方案

启动异常,没有/usr/bin/java目录

修改配置文件vi /etc/init.d/jenkins

candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/lib/jvm/java-1.7.0/bin/java
/usr/lib/jvm/jre-1.7.0/bin/java
/usr/lib/jvm/java-11.0/bin/java
/usr/lib/jvm/jre-11.0/bin/java
/usr/lib/jvm/java-11-openjdk-amd64
/usr/bin/java
/usr/local/jdk1.8.0_171/bin/java  #这一排是自己的java环境地址
"

解决方案2软连接

ln -s /usr/local/jdk1.8.0_161/bin/java /usr/bin/java

你可能感兴趣的:(jenkins启动失败 jenkins.service failed Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录)