2

Trying to move from Java 8 to 11, but Jenkins doesn't run under 11. The weekly experimental builds say they will work with java 10, so I thought, I'll help them test this.

So I upgrade to jenkins_2.151_all.deb (on my ubuntu box), but now I keep getting this error message:

thomas@testbox:~$ systemctl status jenkins.service
● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2018-11-15 14:12:46 UTC; 6s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 8127 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILU

Nov 15 14:12:46 testbox jenkins[8127]: Found an incorrect Java version
Nov 15 14:12:46 testbox jenkins[8127]: Java version found:
Nov 15 14:12:46 testbox jenkins[8127]: java version "11" 2018-09-25
Nov 15 14:12:46 testbox jenkins[8127]: Java(TM) SE Runtime Environment 18.9 (bui
Nov 15 14:12:46 testbox jenkins[8127]: Java HotSpot(TM) 64-Bit Server VM 18.9 (b
Nov 15 14:12:46 testbox jenkins[8127]: Aborting
Nov 15 14:12:46 testbox systemd[1]: jenkins.service: Control process exited, cod
Nov 15 14:12:46 testbox systemd[1]: Failed to start LSB: Start Jenkins at boot t
Nov 15 14:12:46 testbox systemd[1]: jenkins.service: Unit entered failed state.
Nov 15 14:12:46 testbox systemd[1]: jenkins.service: Failed with result 'exit-co

So I follow the directions here: Jenkins fails when running "service start jenkins" on the highest ranked answer to run against my java 11 and I keep getting the same error.

So then I think, screw it. I'm going to run jenkins under my java8 instance. So I change the path inserted above to run against /opt/java8 which is where my java is installed. I get:

thomas@testbox:/opt$ systemctl status -l jenkins.service
● jenkins.service - LSB: Start Jenkins at boot time
   Loaded: loaded (/etc/init.d/jenkins; bad; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2018-11-15 14:15:50 UTC; 1min 3s
     Docs: man:systemd-sysv-generator(8)
  Process: 8237 ExecStart=/etc/init.d/jenkins start (code=exited, status=1/FAILU

Nov 15 14:15:50 testbox jenkins[8237]: Found an incorrect Java version
Nov 15 14:15:50 testbox jenkins[8237]: Java version found:
Nov 15 14:15:50 testbox jenkins[8237]: java version "1.8.0_101"
Nov 15 14:15:50 testbox jenkins[8237]: Java(TM) SE Runtime Environment (build 1.
Nov 15 14:15:50 testbox jenkins[8237]: Java HotSpot(TM) 64-Bit Server VM (build 
Nov 15 14:15:50 testbox jenkins[8237]: Aborting
Nov 15 14:15:50 testbox systemd[1]: jenkins.service: Control process exited, cod
Nov 15 14:15:50 testbox systemd[1]: Failed to start LSB: Start Jenkins at boot t
Nov 15 14:15:50 testbox systemd[1]: jenkins.service: Unit entered failed state.
Nov 15 14:15:50 testbox systemd[1]: jenkins.service: Failed with result 'exit-co

So now it's complaining even about java 8.

Not sure what to try next

MWiesner
  • 8,868
  • 11
  • 36
  • 70
Thom
  • 14,013
  • 25
  • 105
  • 185
  • I resolved the same issue with [this solution](https://dorian.fraser-moore.com/works/5054500/ubuntu-and-jenkins-found-an-incorrect-java-version) – Muhammad Tariq Dec 25 '20 at 08:21

3 Answers3

2

It actually looks like an issue in /etc/init.d/jenkins testing for the Java version.

executing systemctl status jenkins.service command returned a message mentioned below.

Found an incorrect Java version

Java version found:

openjdk version "11.0.9.1" 2020-11-04

In /etc/init.d/jenkins file the last line was setting JAVA_VERSION to 11.09 which doesn't match anything in JAVA_ALLOWED_VERSION.

To fix it update that permissive sed line in /etc/init.d/jenkins file, changing it to:

JAVA_VERSION=$($JAVA -version 2>&1 | sed -n ';s/.* version "\([0-9]*\)\.\([0-9]*\)\..*".*/\1\2/p;')

Reference: https://github.com/jenkinsci/packaging/pull/198

Trilok Nagvenkar
  • 896
  • 9
  • 14
1

sudo update-alternatives --config java select java 8 enter selection no eg. 2 then start jenkins if already

Raj
  • 11
  • 1
0

Update

Since version 2.175 (release on 2019-04-28), the official Jenkins changelog states:

Make Debian/Ubuntu launcher script work with Java 11. (issue 57096)

So starting/running Jenkins in J11 environments should be fixed with Jenkins version 2.175 or newer. You might give it a try.

Hope it helps.

MWiesner
  • 8,868
  • 11
  • 36
  • 70