Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins service starts then stops on Windows 7

Tags:

jenkins

I downloaded the native windows Jenkins package and installed it. On installation, it starts as a service in and shows in Task Manager, and also on going to the url localhost:8080. But then it stops. Here is what I get in my jenkins.out.log:

Running from: C:\Program Files (x86)\Jenkins\jenkins.war
webroot: EnvVars.masterEnvVars.get("JENKINS_HOME")
Jenkins home directory: C:\Program Files (x86)\Jenkins found at:  EnvVars.masterEnvVars.get("JENKINS_HOME")

Any ideas what could be causing this? I've checked throuh netstat that no other process is using the port 8080.

like image 260
Karan Avatar asked Dec 15 '22 03:12

Karan


2 Answers

I found that the java.exe process was hung and keeping Jenkins from starting. I killed the java process and then jenkins service started up just fine.

Use process explorer.

like image 65
brady321 Avatar answered Dec 17 '22 16:12

brady321


It's possible to start jenkins via the command line using java -jar jenkins.war, however, because the process is started via the command line it will also end when that command window is closed.

A better way would be to start the service via jenkins.exe but you would have to remind doing that at every startup.

Ultimately we have settled with a batch script with the following content:

cd "C:\Program Files (x86)\Jenkins"
start javaw -jar jenkins.war >> outputFile.txt

adding start before calling javaw makes sure that the command window is not attached to the process started, making it possible to safely close down the command line.

Using >> outputFile.txt writes the command window feedback in a text file, making debugging a whole lot easier when Jenkins ever breaks down!

Save it in a batch script, schedule it with windows Task Scheduler to run at startup et voilà: properly set up Jenkins service. Only make sure it doesn't stop at log-off.

like image 40
Adrian vdBoom Avatar answered Dec 17 '22 18:12

Adrian vdBoom