Reputation: 43
I have a Windows virtual machine with OpenJDK 13 installed that I would like to setup as a Jenkins node/agent.
When I create the node configuration using the Jenkins UI and select Launch Method: Launch Agent by connecting it to the master it provides a link to download slave-agent.jnlp
On a system with the original jdk/jre older than version 9, which contains java web start, if I run that jnlp file, it brings up a window with a menu that includes an option File - Install as A Service
However, as OpenJDK (and I believe any JRE/JDK versions greater than 8) do NOT contain Java Web Start, I cannot seem to gain access to that option.
I am able to successfully run java -jar agent.jar -jnlpUrl https://jenkinsserver/blah/slave-agent.jnlp -secret blah -workDir "somedirectory" and have the node register with Jenkins, but it is not running as a service.
I had an older agent that was still using old version of JRE, so I looked at its Jenkins service configuration and unfortunately it seems to be relying on executable(s), .config file(s), and xml file(s), which I cannot determine the source of, beyond they must be created when running the "Install as a service" instructions from slave-agent.jnlp
I also attempted to use IcedTea-Web which is apparently supposed to be a Java Web Start replacement, but I've had no success.
Can anyone tell me how to setup a Windows machine running OpenJDK as a Jenkins node/agent with the Jenkins node/agent components running as a Windows service?
Upvotes: 3
Views: 6244
Reputation: 2723
If you want to setup a Java base application as a service, I believe the best option would be to use Procrun from Apache. It is the exact method that Tomcat uses.
Upvotes: 0
Reputation: 353
I had a similar issue and now I use NSSM.
cmd
and install the service (I used JenkinsService as Servicename):
<path to nssm.exe>\nssm install <Servicename>
Path
Arguments
:
-jar agent.jar -jnlpUrl https://jenkinsserver/blah/slave-agent.jnlp -secret blah -workDir "somedirectory"
Now you can check the new service JenkinsService in the windows service manager. As soon as it's running you can check the connection to the master.
Upvotes: 2