Hi, I’m having an issue with restarting a Jenkins instance. Little background on my setup:
I’m running Jenkins 2.387.1 on Windows via this command in cmd using java version 17.0.4.1
java -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar C:\jenkins\jenkins.war --httpPort=9090
I have tried using jenkins.exe and adding it as a Windows service, but that didn’t work for me because the automation tests I’m running need to be able to use the windows GUI… but that’s not important now.
When I restart Jenkins using the URL localhost:9090/restart I get the following error in the cmd window:
2023-05-30 09:27:52.185+0000 [id=17635] INFO hudson.lifecycle.Lifecycle#onStatusUpdate: Restart in 5 seconds
2023-05-30 09:27:57.186+0000 [id=17635] INFO hudson.lifecycle.Lifecycle#onStop: Stopping Jenkins as requested by tpmteam
2023-05-30 09:27:57.210+0000 [id=17635] INFO hudson.lifecycle.Lifecycle#onStatusUpdate: Stopping Jenkins
2023-05-30 09:27:57.327+0000 [id=17635] INFO jenkins.model.Jenkins$16#onAttained: Started termination
2023-05-30 09:27:57.353+0000 [id=17635] INFO h.p.b.global.Lifecycle#shutdown: Shutdown complete - Global TimeOut ScheduledExecutorService had 0 tasks pending
2023-05-30 09:27:57.363+0000 [id=17635] INFO jenkins.model.Jenkins$16#onAttained: Completed termination
2023-05-30 09:27:57.363+0000 [id=17635] INFO jenkins.model.Jenkins#_cleanUpDisconnectComputers: Starting node disconnection
2023-05-30 09:27:57.370+0000 [id=17635] INFO j.s.DefaultJnlpSlaveReceiver#channelClosed: restart thread for TPMBuild terminated: java.nio.channels.ClosedChannelException
2023-05-30 09:27:57.459+0000 [id=17635] INFO jenkins.model.Jenkins#_cleanUpShutdownPluginManager: Stopping plugin manager
2023-05-30 09:27:57.552+0000 [id=17635] INFO jenkins.model.Jenkins#_cleanUpPersistQueue: Persisting build queue
2023-05-30 09:27:57.569+0000 [id=17635] INFO jenkins.model.Jenkins#_cleanUpAwaitDisconnects: Waiting for node disconnection completion
2023-05-30 09:27:57.570+0000 [id=17635] INFO hudson.lifecycle.Lifecycle#onStatusUpdate: Jenkins stopped
2023-05-30 09:27:57.597+0000 [id=17635] WARNING jenkins.model.Jenkins$19#run: Failed to restart Jenkins
java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:494)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:159)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
Caused: java.io.IOException: Cannot run program "C:\jenkins\jenkins.exe" (in directory "C:\jenkins"): CreateProcess error=2, The system cannot find the file specified
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
at hudson.Proc$LocalProc.<init>(Proc.java:254)
at hudson.Proc$LocalProc.<init>(Proc.java:223)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
at hudson.Launcher$ProcStarter.start(Launcher.java:509)
at hudson.Launcher$ProcStarter.join(Launcher.java:520)
at hudson.lifecycle.WindowsServiceLifecycle.restart(WindowsServiceLifecycle.java:146)
at jenkins.model.Jenkins$19.run(Jenkins.java:4552)
The question here is why the Jenkins instance (started via the .war file) is trying to call the jenkins.exe that doesn’t exist?
I tried creating a jenkins.exe file from a .bat containing the java line to start Jenkins but still get other issues.