• Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录


    [root@localhost /]# systemctl status jenkins.service
    ● jenkins.service - LSB: Jenkins Automation Server
       Loaded: loaded (/etc/rc.d/init.d/jenkins; bad; vendor preset: disabled)
       Active: failed (Result: exit-code) since 六 2019-09-28 09:27:02 CST; 27min ago
         Docs: man:systemd-sysv-generator(8)
      Process: 30069 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)
    
    9月 28 09:27:02 localhost.localdomain systemd[1]: Starting LSB: Jenkins Automation Server...
    9月 28 09:27:02 localhost.localdomain runuser[30074]: pam_unix(runuser:session): session opened for user jenkins by (uid=0)
    9月 28 09:27:02 localhost.localdomain jenkins[30069]: Starting Jenkins bash: /usr/bin/java: 没有那个文件或目录
    9月 28 09:27:02 localhost.localdomain jenkins[30069]: [失败]
    9月 28 09:27:02 localhost.localdomain systemd[1]: jenkins.service: control process exited, code=exited status=1
    9月 28 09:27:02 localhost.localdomain systemd[1]: Failed to start LSB: Jenkins Automation Server.
    9月 28 09:27:02 localhost.localdomain systemd[1]: Unit jenkins.service entered failed state.
    9月 28 09:27:02 localhost.localdomain systemd[1]: jenkins.service failed.
    
    
    [root@localhost /]# which java
    /usr/local/iron/jdk1.8.0_191/bin/java
    
    #JDK的安装路径和Jenkins 默认的JDK路径不一致
    #建立软连接
    ln -s /usr/local/iron/jdk1.8.0_191/jdk/bin/java /usr/bin/java
    
    #如果多版本,可以使用下面的命令更新
    [root@localhost /]# update-alternatives --install /usr/bin/java java /usr/local/iron/jdk1.8.0_191/bin/java 300
    [root@localhost /]# update-alternatives --install /usr/bin/javac javac /usr/local/iron/jdk1.8.0_191/bin/javac 300
    [root@localhost /]# update-alternatives --install /usr/bin/jar jar /usr/local/iron/jdk1.8.0_191/bin/jar 300
    [root@localhost /]# update-alternatives --install /usr/bin/javah javah /usr/local/iron/jdk1.8.0_191/bin/javah 300
    [root@localhost /]# update-alternatives --install /usr/bin/javap javap /usr/local/iron/jdk1.8.0_191/bin/javap 300
    [root@localhost /]# update-alternatives --config java
    
    [root@localhost /]# which java
    /usr/bin/java


    或者修改jenkins配置文件

    vi /etc/rc.d/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/iron/jdk1.8.0_191/bin/java #把自己配置的目录加进去
    "
  • 相关阅读:
    第二阶段--个人冲刺--第七天
    学习进度条12
    第二阶段--个人冲刺--第六天
    第二阶段--个人冲刺--第五天
    第二阶段--个人冲刺--第四天
    第二阶段--个人冲刺--第三天
    从小工到专家阅读笔记03
    团队冲刺第一阶段第十天
    团队冲刺第一阶段第九天
    构建之法阅读笔记05
  • 原文地址:https://www.cnblogs.com/vipsoft/p/11601835.html
Copyright © 2020-2023  润新知