Home > Back-end >  Jenkins wont start
Jenkins wont start

Time:10-04

I am attempting to start and getting the following error

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 ~]#

this is in my /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

I have java installed as can be seen from the java version below

[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)

below is my bash profile showing my JAVA_HOME variable

[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

can anyone help me with this issue. Thank you in advance. It looks to be some issue with Jenkins not being able to find my java version on my server, possibly some link pointing to the wrong location

CodePudding user response:

I am getting the same error.

Journalctl log: invalid Java version: openjdk version "1.8.0_342"

java -version openjdk version "1.8.0_342" OpenJDK Runtime Environment (build 1.8.0_342-b07) OpenJDK 64-Bit Server VM (build 25.342-b07, mixed mode)

CodePudding user response:

It seems like you have multiple java versions available on your machine. Can you update correct version by simply running sudo update-alternatives --config java to avoid jenkins and java version mismatch?

See also: Jenkins fails when running "service start jenkins"

  • Related