How to kept Jenkins agent online after windows reboot

Hello All

I have a jenkins master based on linux and two agent machine on windows 10 , earlier i used java jnlp launcher to launch my agent but after going to openwebstart the jnlp file launched via openwebstart wont keep connected my agent , it terminate the agent soon after it gets connected and prompt the following error

Nov 09, 2021 9:53:03 AM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFORMATION: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Nov 09, 2021 9:53:03 AM org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run
INFORMATION: Waiting for ProtocolStack to start.
Nov 09, 2021 9:53:08 AM hudson.remoting.UserRequest perform
WARNUNG: LinkageError while performing UserRequest:hudson.slaves.SlaveComputer$SlaveInitializer@6cfcc55d
java.lang.ExceptionInInitializerError
at hudson.slaves.SlaveComputer$SlaveInitializer.call(SlaveComputer.java:1042)
at hudson.slaves.SlaveComputer$SlaveInitializer.call(SlaveComputer.java:1033)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:376)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:122)
at java.lang.Thread.run(Unknown Source)
Caused by: java.security.AccessControlException: access denied (“java.util.PropertyPermission” “hudson.util.RingBufferLogHandler.defaultSize” “read”)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at com.sun.javaws.security.JavaWebStartSecurity.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
at java.lang.System.getProperty(Unknown Source)
at java.lang.Integer.getInteger(Unknown Source)
at java.lang.Integer.getInteger(Unknown Source)
at hudson.util.RingBufferLogHandler.(RingBufferLogHandler.java:39)
… 11 more

Just because of this issue every time i have to manually run agent.jar file via command prompt in order to online my agent after my agent machine reboots

I have a job on both my agent machine to reboot and after reboot jobs completed both my agent went offline until i have to manually connect them via running agent.jar file on cmd

My question is : Is there is any way to keep my agent online automatically after my agent machine reboots and i can get rid of this manual exercise of running agent file via cmd

Note: I dont want to run jenkins as a service bc i run automation tests using Ranorex Studio and it requires full interactive control on machine that is why running jenkins as a windows service is not a option for me
Jenkins version: 2.320
JDK version on Master and both agents: JDK 1.8.0 262
Windows OS : 2010
OpenWebStart version : 1.4.0
Any help/lead in this issue

Thanks in advance

You could run the agent from a batch file that is an endless loop, preferably with a sleep statement between each retry. How to create an infinite loop in Windows batch file? - Stack Overflow provides several different ways to create a batch file that loops forever.

Hey thanks for the reply , i tried to run the agent from agent.jar file but getting this warning in console and my agent is not going online

@ECHO ON
start java -jar C:\Jenkins\agent.jar

Output:- WARNING: Are you running slave agent from an interactive console?
If so, you are probably using it incorrectly.
See Jenkins : Launching slave.jar from from console
<===[JENKINS REMOTING CAPACITY]===>rO0ABXNyABpodWRzb24ucmVtb3RpbmcuQ2FwYWJpbGl0eQAAAAAAAAABAgABSgAEbWFza3hwAAAAAAAAAB4=??

The Jenkins page for the agent (as in http://jenkins.example.com:8080/computer/your-agent-name/) provides the full command line that needs to be used. The message you’re seeing usually means that one or more required arguments were not passed on the command line.

1 Like