vincentv587 2023-09-13 16:11 采纳率: 0%
浏览 33

centos 安装jenkins 启动失败,已经修改了Java路径,和jenkins配置,还是异常

服务器的配置如下:

1.Java配置
[root@iZbp10bqzpt2q0q97t8lrqZ /]# java -version
openjdk version "1.8.0_312"
OpenJDK Runtime Environment (build 1.8.0_312-b07)
OpenJDK 64-Bit Server VM (build 25.312-b07, mixed mode)
[root@iZbp10bqzpt2q0q97t8lrqZ ~]# which java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java
-------------------------------------
2. jenkins 配置 
vim /usr/lib/systemd/system/jenkins.service

[root@iZbp10bqzpt2q0q97t8lrqZ log]# cat /usr/lib/systemd/system/jenkins.service
#
# This file is managed by systemd(1). Do NOT edit this file manually!
# To override these settings, run:
#
#     systemctl edit jenkins
#
# For more information about drop-in files, see:
#
#     https://www.freedesktop.org/software/systemd/man/systemd.unit.html
#

[Unit]
Description=Jenkins Continuous Integration Server
Requires=network.target
After=network.target

[Service]
Type=notify
NotifyAccess=main
ExecStart=/usr/bin/jenkins
Restart=on-failure
SuccessExitStatus=143

# Configures the time to wait for start-up. If Jenkins does not signal start-up
# completion within the configured time, the service will be considered failed
# and will be shut down again. Takes a unit-less value in seconds, or a time span
# value such as "5min 20s". Pass "infinity" to disable the timeout logic.
#TimeoutStartSec=90

# Unix account that runs the Jenkins daemon
# Be careful when you change this, as you need to update the permissions of
# $JENKINS_HOME, $JENKINS_LOG, and (if you have already run Jenkins)
# $JENKINS_WEBROOT.
User=root
Group=root

# Directory where Jenkins stores its configuration and workspaces
Environment="JENKINS_HOME=/var/lib/jenkins"
WorkingDirectory=/var/lib/jenkins

# Location of the Jenkins WAR
#Environment="JENKINS_WAR=/usr/share/java/jenkins.war"

# Location of the exploded WAR
Environment="JENKINS_WEBROOT=%C/jenkins/war"

# Location of the Jenkins log. By default, systemd-journald(8) is used.
#Environment="JENKINS_LOG=%L/jenkins/jenkins.log"

# The Java home directory. When left empty, JENKINS_JAVA_CMD and PATH are consulted.
#Environment="JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64"
Environment="JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.312.b07-2.el8_5.x86_64/jre/bin/java"

# The Java executable. When left empty, JAVA_HOME and PATH are consulted.
#Environment="JENKINS_JAVA_CMD=/etc/alternatives/java"

# Arguments for the Jenkins JVM
Environment="JAVA_OPTS=-Djava.awt.headless=true"

# IP address to listen on for HTTP requests.
# The default is to listen on all interfaces (0.0.0.0).
#Environment="JENKINS_LISTEN_ADDRESS="

# Port to listen on for HTTP requests. Set to -1 to disable.
# To be able to listen on privileged ports (port numbers less than 1024),
# add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities
# directive below.
Environment="JENKINS_PORT=8080"

# IP address to listen on for HTTPS requests. Default is disabled.
#Environment="JENKINS_HTTPS_LISTEN_ADDRESS="

# Port to listen on for HTTPS requests. Default is disabled.
# To be able to listen on privileged ports (port numbers less than 1024),
# add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities
# directive below.
#Environment="JENKINS_HTTPS_PORT=443"

# Path to the keystore in JKS format (as created by the JDK's keytool).
# Default is disabled.
#Environment="JENKINS_HTTPS_KEYSTORE=/path/to/keystore.jks"

# Password to access the keystore defined in JENKINS_HTTPS_KEYSTORE.
# Default is disabled.
#Environment="JENKINS_HTTPS_KEYSTORE_PASSWORD=s3cR3tPa55w0rD"

# IP address to listen on for HTTP2 requests. Default is disabled.
#Environment="JENKINS_HTTP2_LISTEN_ADDRESS="

# HTTP2 port to listen on. Default is disabled.
# To be able to listen on privileged ports (port numbers less than 1024),
# add the CAP_NET_BIND_SERVICE capability to the AmbientCapabilities
# directive below.
#Environment="JENKINS_HTTP2_PORT="

# Controls which capabilities to include in the ambient capability set for the
# executed process. Takes a whitespace-separated list of capability names, e.g.
# CAP_SYS_ADMIN, CAP_DAC_OVERRIDE, CAP_SYS_PTRACE. Ambient capability sets are
# useful if you want to execute a process as a non-privileged user but still
# want to give it some capabilities. For example, add the CAP_NET_BIND_SERVICE
# capability to be able to listen on privileged ports (port numbers less than
# 1024).
#AmbientCapabilities=CAP_NET_BIND_SERVICE

# Debug level for logs. The higher the value, the more verbose. 5 is INFO.
#Environment="JENKINS_DEBUG_LEVEL=5"

# Set to true to enable logging to /var/log/jenkins/access_log.
#Environment="JENKINS_ENABLE_ACCESS_LOG=false"

# Servlet context (important if you want to use reverse proxying)
#Environment="JENKINS_PREFIX=/jenkins"

# Arbitrary additional arguments to pass to Jenkins.
# Full option list: java -jar jenkins.war --help
#Environment="JENKINS_OPTS="

# Maximum core file size. If unset, the value from the OS is inherited.
#LimitCORE=infinity

# Maximum file size. If unset, the value from the OS is inherited.
#LimitFSIZE=infinity

# File descriptor limit. If unset, the value from the OS is inherited.
#LimitNOFILE=8192

# Maximum number of processes. If unset, the value from the OS is inherited.
#LimitNPROC=32768

# Set the umask to control the permission bits of files that Jenkins creates.
#
# 0027 makes files read-only for group and inaccessible for others, which some
# security sensitive users might consider beneficial, especially if Jenkins
# is running on a server that is used for multiple purposes. Beware that 0027
# permissions would interfere with sudo scripts that run on the controller
# (see JENKINS-25065).
#
# Note also that the particularly sensitive parts of $JENKINS_HOME (such as
# credentials) are always written without 'other' access. So the umask values
# only affect job configuration, build records, etc.
#
# If unset, the value from the OS is inherited, which is normally 0022.
# The default umask comes from pam_umask(8) and /etc/login.defs.
#UMask=0022

[Install]
WantedBy=multi-user.target


------------------------------------------------------
启动Jenkins失败:如下:

systemctl status jenkins.service
● jenkins.service - Jenkins Continuous Integration Server
   Loaded: loaded (/usr/lib/systemd/system/jenkins.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2023-09-13 16:00:00 CST; 12s ago
  Process: 14634 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
 Main PID: 14634 (code=exited, status=1/FAILURE)

Sep 13 16:00:00 iZbp10bqzpt2q0q97t8lrqZ systemd[1]: jenkins.service: Service RestartSec=100ms expired, scheduling restart.
Sep 13 16:00:00 iZbp10bqzpt2q0q97t8lrqZ systemd[1]: jenkins.service: Scheduled restart job, restart counter is at 5.
Sep 13 16:00:00 iZbp10bqzpt2q0q97t8lrqZ systemd[1]: Stopped Jenkins Continuous Integration Server.
Sep 13 16:00:00 iZbp10bqzpt2q0q97t8lrqZ systemd[1]: jenkins.service: Start request repeated too quickly.
Sep 13 16:00:00 iZbp10bqzpt2q0q97t8lrqZ systemd[1]: jenkins.service: Failed with result 'exit-code'.
Sep 13 16:00:00 iZbp10bqzpt2q0q97t8lrqZ systemd[1]: Failed to start Jenkins Continuous Integration Server.
[root@iZbp10bqzpt2q0q97t8lrqZ log]# journalctl -xe
-- 
-- The unit session-420.scope has successfully entered the 'dead' state.
Sep 13 16:00:13 iZbp10bqzpt2q0q97t8lrqZ systemd-logind[845]: Session 420 logged out. Waiting for processes to exit.
Sep 13 16:00:13 iZbp10bqzpt2q0q97t8lrqZ systemd-logind[845]: Removed session 420.
-- Subject: Session 420 has been terminated
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- Documentation: https://www.freedesktop.org/wiki/Software/systemd/multiseat
-- 
-- A session with the ID 420 has been terminated.
Sep 13 16:00:14 iZbp10bqzpt2q0q97t8lrqZ sshd[14758]: Accepted password for root from 100.104.86.26 port 21449 ssh2
Sep 13 16:00:14 iZbp10bqzpt2q0q97t8lrqZ systemd[1]: Started Session 421 of user root.
-- Subject: Unit session-421.scope has finished start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- Unit session-421.scope has finished starting up.
-- 
-- The start-up result is done.
Sep 13 16:00:14 iZbp10bqzpt2q0q97t8lrqZ systemd-logind[845]: New session 421 of user root.
-- Subject: A new session 421 has been created for user root
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- Documentation: https://www.freedesktop.org/wiki/Software/systemd/multiseat
-- 
-- A new session with the ID 421 has been created for the user root.
-- 
-- The leading process of the session is 14758.
Sep 13 16:00:14 iZbp10bqzpt2q0q97t8lrqZ sshd[14758]: pam_unix(sshd:session): session opened for user root by (uid=0)
Sep 13 16:00:14 iZbp10bqzpt2q0q97t8lrqZ sshd[14758]: pam_unix(sshd:session): session closed for user root
Sep 13 16:00:14 iZbp10bqzpt2q0q97t8lrqZ systemd[1]: session-421.scope: Succeeded.
-- Subject: Unit succeeded
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- 
-- The unit session-421.scope has successfully entered the 'dead' state.
Sep 13 16:00:14 iZbp10bqzpt2q0q97t8lrqZ systemd-logind[845]: Session 421 logged out. Waiting for processes to exit.
Sep 13 16:00:14 iZbp10bqzpt2q0q97t8lrqZ systemd-logind[845]: Removed session 421.
-- Subject: Session 421 has been terminated
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
-- Documentation: https://www.freedesktop.org/wiki/Software/systemd/multiseat
-- 
-- A session with the ID 421 has been terminated.
  • 写回答

1条回答 默认 最新

  • CSDN-Ada助手 CSDN-AI 官方账号 2023-09-13 18:08
    关注

    【以下回答由 GPT 生成】

    问题可能有多个潜在原因导致Jenkins启动失败,以下是一些可能的解决方案:

    1. 确保Java路径正确:更改Java路径后,请确保重新登录到服务器或重启服务器来使更改生效。

    2. 检查Java版本:确保Java版本为1.8.0_312。可以使用以下命令检查Java版本:

    java -version
    

    如果Java版本不正确,请确保已正确安装Java并将其路径添加到系统的环境变量中。

    1. 检查Jenkins的systemd配置文件:检查systemd配置文件是否正确。例如,确保ExecStart路径正确指向Jenkins的安装目录。还要确保Jenkins的WorkingDirectory和Environment变量设置正确。

    2. 检查Jenkins日志文件:Jenkins可能会生成日志文件,其中包含有关启动失败的详细错误信息。可以检查Jenkins日志文件以获得更多信息,并尝试解决相关问题。

    3. 查看系统日志:除了Jenkins日志文件外,还可以检查系统的日志文件,例如/var/log/syslog或/var/log/messages,以获取与Jenkins启动相关的任何错误消息。

    在解决问题之前,请确保按照正确的步骤进行了更改和配置,并且没有其他冲突或错误。此外,可以尝试重新安装Jenkins,并确保按照官方文件提供的指南进行配置。如果上述解决方案都没有解决问题,可能需要更详细地分析问题,包括排除其他潜在问题和查看其他相关日志文件。



    【相关推荐】



    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    评论

报告相同问题?

问题事件

  • 创建了问题 9月13日

悬赏问题

  • ¥15 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?