Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot start Jenkins service in Windows after updates

Tags:

I have Jenkins running on Windows as a service. Normally, it starts when machine starts.

After a Windows recommended update this afternoon, and a machine restart, my Jenkins just stopped working.

I start the service but it stops and shows the following warning:

"The Jenkins service on Local Computer started and then stopped. Some  services stop automatically if they are not in use by other services or  programs." 

There is no "jenkins.err.log" file and if I start Jenkins with "java jenkins.war" It works fine.

Any tip whats going on? How to fix this? Please help.

Thank you very much.

like image 635
koxta Avatar asked Jan 28 '18 21:01

koxta


People also ask

Can't start Jenkins service Windows?

One of the most common reasons why Jenkins server can't start in Windows computers is because the version of the Java language was updated after the last shutdown of Jenkins server. In order to configure Jenkins to use the correct Java version, you can follow this procedure: 1. - Edit the jenkins.

Why does Jenkins fail to start?

If you encounter the "Service 'Jenkins' failed to start" error too many times, the account on your computer that should run Jenkins will become locked. You will need to unlock that local account first.

What is the command to restart Jenkins service on Windows?

You can also utilize curl and use the following commands: $ curl -X POST -u <user>:<password> http://<jenkins.server>/restart $ curl -X POST -u <user>:<password> http://<jenkins.server>/safeRestart $ curl -X POST -u <user>:<password> http://<jenkins.server>/exit $ curl -X POST -u <user>:<password> ...


2 Answers

I had the same problem. It appeared that the java runtime enviromment had been updated. In the jenkins installation folder there is as jenkins.wrapper.log. This contains logging from the jenkins.exe service wrapper. In my case it tried to start java from c:\Program Files\Java\jre1.8.0_144\bin. This folder did not exist, instead, java was installed in c:\Program Files\Java\jre1.8.0_161\bin.

In the jenkins installation folder there is also a jenkins.xml. This contains the reference to the java installation in the tag. Change it to your current java installation and it will start again.

like image 90
user1777224 Avatar answered Sep 20 '22 11:09

user1777224


I also had this problem after each java update. But there is a version-independent absolute path, that can be used to start the java run-time: C:\ProgramData\Oracle\Java\javapath\java.exe.

I changed jenkins-slave.xml to use this path:

<executable>C:\ProgramData\Oracle\Java\javapath\java.exe</executable> 
like image 40
Mario Klebsch Avatar answered Sep 18 '22 11:09

Mario Klebsch