jenkins在linux(centos)上启动时报错:/usr/bin/java: No such file

10-22 21:04:24   来源:   评论: 点击:

jenkins启东时报错:Starting jenkins (via systemctl): Job for jenkins service failed because the control process exited with error code See "systemctl status jenkins service " and "journalctl -xe " for details
[dev@localhost jdk1.8]$ sudo service jenkins start
Starting jenkins (via systemctl):  Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
                                                           [FAILED]
[dev@localhost jdk1.8]$ 
 
 
在系统日志中查看jenkins的日志,输出如下:
[dev@localhost jenkins]$ sudo tail -f /var/log/messages | grep jenkins
Oct 22 20:42:15 localhost jenkins: Starting Jenkins bash: /usr/bin/java: No such file or directory
Oct 22 20:42:15 localhost jenkins: [FAILED]
Oct 22 20:42:15 localhost systemd: jenkins.service: control process exited, code=exited status=1
Oct 22 20:42:15 localhost systemd: Unit jenkins.service entered failed state.
Oct 22 20:42:15 localhost systemd: jenkins.service failed.
 
 
原因:从日志中可以看出是/usr/bin/java命令无法找到造成的
解决办法:
修改“vi /etc/init.d/jenkins”,把java路径加上即可,如下:
# Search usable Java. We do this because various reports indicated
# that /usr/bin/java may not always point to Java >= 1.6
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
candidates="
/etc/alternatives/java
/usr/lib/jvm/java-1.6.0/bin/java
/usr/lib/jvm/jre-1.6.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-1.8.0/bin/java
/usr/lib/jvm/jre-1.8.0/bin/java
/usr/bin/java
/usr/local/jdk1.8/bin/java
"
 

相关热词搜索:jenkins报错

上一篇:如何在linux(centos7)上修改jenkins默认主目录.jenkins路径 下一篇:最后一页
分享到: 收藏