[英]Jenkins wont start
我正在嘗試啟動並收到以下錯誤
root@ip-172-31-80-112 ~]# systemctl start jenkins
Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details
[root@ip-172-31-80-112 ~]# systemctl status jenkins
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/usr/lib/systemd/system/jenkins.service; enabled; vendor preset: disabled)
Active: failed (Result: start-limit) since Mon 2022-10-03 10:51:06 UTC; 31s ago
Process: 21705 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 21705 (code=exited, status=1/FAILURE)
Oct 03 10:51:05 ip-172-31-80-112.ec2.internal systemd[1]: jenkins.service: main process exited, code=exited, status=1/FAILURE
Oct 03 10:51:05 ip-172-31-80-112.ec2.internal systemd[1]: Failed to start Jenkins Continuous Integration Server.
Oct 03 10:51:05 ip-172-31-80-112.ec2.internal systemd[1]: Unit jenkins.service entered failed state.
Oct 03 10:51:05 ip-172-31-80-112.ec2.internal systemd[1]: jenkins.service failed.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: jenkins.service holdoff time over, scheduling restart.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: Stopped Jenkins Continuous Integration Server.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: start request repeated too quickly for jenkins.service
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: Failed to start Jenkins Continuous Integration Server.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: Unit jenkins.service entered failed state.
Oct 03 10:51:06 ip-172-31-80-112.ec2.internal systemd[1]: jenkins.service failed.
[root@ip-172-31-80-112 ~]#
這是在我的 /etc/init.d/jenkins
# Search usable Java as /usr/bin/java might not point to minimal version required by Jenkins.
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
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-11.0/bin/java
/usr/lib/jvm/jre-11.0/bin/java
/usr/lib/jvm/java-11-openjdk-amd64
/usr/bin/java
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64
我安裝了 java 從下面的 java 版本可以看出
[root@ip-172-31-80-112 ~]# java -version
openjdk version "1.8.0_342"
enter code hereenter code here`OpenJDK Runtime Environment (build 1.8.0_342-b07)
OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode)
下面是我的 bash 配置文件,顯示了我的 JAVA_HOME 變量
[root@ip-172-31-80-112 ~]# cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.amzn2.0.1.x86_64
MAVEN_HOME=/opt/apache-maven-3.8.6
M2=/opt/apache-maven-3.8.6
PATH=$PATH:$HOME/bin:$JAVA_HOME:MAVEN_HOME:$M2
誰能幫我解決這個問題。 先感謝您。 似乎是 Jenkins 無法在我的服務器上找到我的 java 版本,可能是一些鏈接指向了錯誤的位置
您的機器上似乎有多個 java 版本可用。 您可以通過簡單地運行 sudo update-alternatives --config java 來更新正確的版本以避免 jenkins 和 java 版本不匹配嗎?
根據 Jenkins 版本,錯誤不是很清楚,但確保 Jenkins>=2.357 使用的是 Java 11 安裝,而不是 Java 8 安裝。
我剛剛解決了我的,這與這篇文章的問題類似。
只是一些背景故事:我嘗試在我的 Ubuntu 22.10 上安裝 Jenkins 三 (3) 次,一切順利。 但都未能啟動。
我使用的最后一個安裝說明來自此鏈接: https://community.jenkins.io/t/ubuntu-20-04-initial-jenkins-startup-failure/1419
-- Mark Waite 先生的回答 -- Jenkins 治理委員會。
基本上:
$ sudo apt-get install openjdk-11-jdk-headless
$ curl -fsSL https://pkg.jenkins.io/debian/jenkins.io.key | sudo tee /usr/share/keyrings/jenkins-keyring.asc > /dev/null
$ echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian binary/ | sudo tee /etc/apt/sources.list.d/jenkins.list > /dev/null
$ sudo apt-get update
$ sudo apt-get install jenkins
然后它失敗了:
...
● jenkins.service - Jenkins Continuous Integration Server
Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2023-01-25 21:37:10 AEDT; 6ms ago
Process: 11589 ExecStart=/usr/bin/jenkins (code=exited, status=1/FAILURE)
Main PID: 11589 (code=exited, status=1/FAILURE)
CPU: 3.818s
dpkg: error processing package jenkins (--configure):
installed jenkins package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
jenkins
E: Sub-process /usr/bin/dpkg returned an error code (1)
behai@HP-Pavilion-15:~$
谷歌搜索沒有給我任何答案。 如此隨意,我試過:
/usr/bin/jenkins
output很長,我把相關的轉一下:
...
java.io.IOException: Failed to start Jetty
...
Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080
Caused by: java.net.BindException: Address already in use
...
java.net.BindException: Address already in use
...
Caused: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:8080
Caused: java.io.IOException: Failed to start Jetty
...
我忘記了我已經為 Apache2 設置了端口8080。我剛剛停止並禁用了 Apache2,然后使用以下命令啟動 Jenkins:
$ systemctl start jenkins.service
它現在正在運行。 我希望這對您有所幫助,盡管您的情況可能並非如此。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.