The server rejected the connection: None of the protocols were accepted
Asked Answered
H

10

15

I'm facing a weird issue when I launch Jenkins as Windows service in my client VM.

1) I have launched Jenkins as Windows service in my client side master machine (a Windows VM) and configured my local machine as a slave and I'm unable to establish the connection between master and slave. I'm getting the following error:

"java.lang.Exception: The server rejected the connection: None of the protocols were accepted"

Both master and slave are in same network (client's network, connected slave using VPN).

Client Master machine's domain name ABC
Local machine domain name xyz

console output

2) I have stopped the Jenkins as Windows service and launched again through command prompt using

"java -jar jenkins.war"

now I'm able to establish connection between master and slave without any issues.

3) Now I have launched Jenkins as Windows service in my **local machine as master and one of the local machine as slave, and successfully established the connection between master and slave.

What exactly is the reason for not establishing the connection between master and slave using point (1)?

Hillhouse answered 10/2, 2016 at 7:35 Comment(0)
D
10

In my case that was linked to disabled protocol.

Check next: If your Jenkins is supporting JNLPv4, enable it before use.

Jenkins -> Global Security Configuration -> Agents -> Agent protocols -> Inbound TCP Agent Protocol/4 (TLS encryption)

enter image description here

Depriest answered 16/1, 2020 at 18:29 Comment(0)
T
4

The issue is from JENKINS side. The Bug is already raised on JENKINS Forum & Status is still Critical & Unresolved :

https://issues.jenkins-ci.org/browse/JENKINS-29616

As Per the Description :

A scheduled batch is attempting to start the slave agent with the following script:

taskkill /f /im "EXCEL.exe"
taskkill /f /im "ipy.exe"
taskkill /f /im "jp2launcher.exe"

javaws http://172.16.8.57:8080/computer/SSW73210/slave-agent.jnlp

When the slave agent opens, it fails to do anything but the enclosed error. After rebooting, this issue fails to reproduce, but this seems dramatically more common when the slave is left on overnight.

Trumpeter answered 25/5, 2017 at 11:30 Comment(0)
P
3

I had a similar issue, here is what I did to resolve mine:

After upgrading from Jenkins 1.x to 2.x I never cleared the remote root directory of the slaves (in my case c:\jenkins). Everytime I installed the slave as a service I would get the exact same error. I finally figured out my problem after numerous grey hair: Once I removed the contents from that directory, and installed the jenkins slave as a windows service, the contents were repopulated and the slave connected as expected.

Hope this helps

Pork answered 15/5, 2018 at 16:18 Comment(0)
B
1

I fixed it by installing an earlier version of Java. I used the 1.8.0_131 JDK.

Bealle answered 21/6, 2018 at 9:48 Comment(0)
T
1

I also faced this issue and was able to fix it, maybe? It happened that a same agent was running on a different VM. I closed it, reconnected successfully and no error message anymore.

Tolland answered 27/11, 2018 at 11:10 Comment(0)
B
1

Goto jenkins --> Manage jenkins --> configure system --> http://yoursystem ip:8080/ Make sue it will be http not https. Manage Jenkins --> Global security--> Agent -->

enter image description here

Create Agent node gain it will work

Between answered 31/1, 2023 at 12:24 Comment(0)
A
0

I faced the same issue and adding to the above answers, I disabled firewall in Jenkins master and everything went fine. Also, this is strictly not recommended for production environments. Newbie didn't know how to configure firewall and this was done at home lab, so I found it useful.

Argumentum answered 23/5, 2019 at 10:52 Comment(0)
A
0

i faced similar issue

had to run the slave-agent.jar from cmd ( run as Administrator )

> javaws "location of slave-agent.jar"  
Aquarist answered 27/3, 2020 at 9:26 Comment(0)
D
0

I looked at the issue https://issues.jenkins-ci.org/browse/JENKINS-29616 mentioned in LuFFy's answer and, along with junior1024's answer, found a pattern that helped me. Specifically, the naming of the agent executable: agent executable names have to be unique

I'm running on Server 2019 and running the agents as windows servers using WinSW. I downloaded WinSW and organized my agents like this:

/Agent1
-> agent.jar
-> agent.exe
-> agent.xml
/Agent2
-> agent.jar
-> agent.exe
-> agent.xml

After installing and testing each agent individually with success, I tried to run both at the same time and ran into issues. Specifically whichever agent was started second would fail, showing the symptoms described in this post and in the Jenkins Bug (unable to connect, restarting, etc).

But if I ran the second agent using the cli java -jar agent.jar it worked.

Eventually I tried the following and it worked:

/Agent1
-> agent.jar
-> agent1.exe
-> agent1.xml
/Agent2
-> agent.jar
-> agent2.exe
-> agent2.xml
Diclinous answered 27/11, 2020 at 22:27 Comment(0)
G
0

It is weird that I encountered the same issue for everything went well before. After editing the hosts file in the master machine, errors disappear when running commands in the slave machine. So it is the network name resolution issue.

Girdler answered 4/3, 2021 at 10:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.