jenkins 这货启动不起来,怎么搞

2018-05-12 11:31:35 +08:00
 wsds

启动的时候,提示存在不正确的 java1.7 版本,但我的版本是 1.8 啊,什么鬼,启动不起来

root@root-59:~$ ps -ef|grep jenkins

root 25034  1931  0 11:26 pts/17   00:00:00 grep --color=auto jenkins

root@root-59:~$ sudo service jenkins start
[sudo] password for root: 

Found an incorrect Java version
Java version found:
java version "1.7.0_171"
OpenJDK Runtime Environment (IcedTea 2.6.13) (7u171-2.6.13-0ubuntu0.14.04.2)
OpenJDK 64-Bit Server VM (build 24.171-b02, mixed mode)

Aborting

root@root-59:~$ java -version

java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
root@root-59:~$ 


5707 次点击
所在节点    程序员
31 条回复
zhantss
2018-05-12 22:52:34 +08:00
安装版的 jenkins,默认是创建了一个 jenkins 用户,改这个用户的配置就行
防止发生意外可以改 /etc/default/jenkins 里面的设置,不一定是这个位置,你可以查一下对应软件包的配置文件位置
tedzhou1221
2018-05-13 02:26:50 +08:00
Docker Jenkins 更方便,哈哈
zqcolor
2018-05-13 13:03:30 +08:00
那就卸载这个 openjdk7
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java

然后安装 jdk 8 试试
wsds
2018-05-14 18:50:33 +08:00
@zhantss 有这个文件,要改什么内容啊

# defaults for Jenkins automation server

# pulled in from the init script; makes things easier.
NAME=jenkins

# arguments to pass to java

# Allow graphs etc. to work even when an X server is present
JAVA_ARGS="-Djava.awt.headless=true"

#JAVA_ARGS="-Xmx256m"

# make jenkins listen on IPv4 address
#JAVA_ARGS="-Djava.net.preferIPv4Stack=true"

PIDFILE=/var/run/$NAME/$NAME.pid

# user and group to be invoked as (default to jenkins)
JENKINS_USER=$NAME
JENKINS_GROUP=$NAME

# location of the jenkins war file
JENKINS_WAR=/usr/share/$NAME/$NAME.war

# jenkins home location
JENKINS_HOME=/var/lib/$NAME

# set this to false if you don't want Jenkins to run by itself
# in this set up, you are expected to provide a servlet container
# to host jenkins.
RUN_STANDALONE=true

# log location. this may be a syslog facility.priority
JENKINS_LOG=/var/log/$NAME/$NAME.log
#JENKINS_LOG=daemon.info

# Whether to enable web access logging or not.
# Set to "yes" to enable logging to /var/log/$NAME/access_log
JENKINS_ENABLE_ACCESS_LOG="no"

# OS LIMITS SETUP
# comment this out to observe /etc/security/limits.conf
# this is on by default because http://github.com/jenkinsci/jenkins/commit/2fb288474e980d0e7ff9c4a3b768874835a3e92e
# reported that Ubuntu's PAM configuration doesn't include pam_limits.so, and as a result the # of file
wsds
2018-05-14 18:52:04 +08:00
@zqcolor 公用环境,不能乱卸载组件啊
wsds
2018-05-15 09:24:40 +08:00
zqcolor
2018-05-15 10:31:51 +08:00
网上查的,可以试试看

https://stackoverflow.com/questions/49367311/start-jenkins-with-jdk-8-without-changing-system-java-home


Set JENKINS_JAVA option in /etc/sysconfig/jenkins file.

The variable name might be different depending on your operating system and package source but the /etc/sysconfig/jenkins file is usually the configuration file for your jenkins service.
wsds
2018-05-28 12:43:22 +08:00
还是不行啊
RX03
2020-01-14 15:20:31 +08:00
两年了。。。
我自己这样暴力设置可以起来
1. cd /etc/init.d 2. sudo vim jenkins 3. 注释掉 PATH 部分,因为之前编译多个版本的 AOSP,java 环境乱的压批,在 /etc/profile 里 export 了,在这里直接加上 source /etc/profile
ubuntu@linux:/etc/init.d$ ./jenkins -> Correct java version found
最后,docker 大法好
TreePu
2020-12-04 16:37:32 +08:00
1,安装 jdk1.8
TreePu
2020-12-04 16:41:09 +08:00
1,安装 JDK1.8:sudo apt-get install openjdk-8-jdk
2,切换 JDK 版本:sudo update-alternatives --config java 输入数字,Enter
3,修改 Jenkins 配置文件的 PATH 为 1.8 的路径
sudo vi /etc/init.d/jenkins
## PATH=/bin:/usr/bin:/sbin:/usr/sbin 旧的
PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin/java 新的
4,重启 Jenkins,成功

今天遇到了,把解决过程分享一下

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/454258

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX