jenkins容器部署后宿主机作为节点,通过java web启动代理时报错:The server rejected the connection: None of the protocols were accepted

问题

jenkins容器部署后宿主机作为节点,通过java web启动代理时报错:The server rejected the connection: None of the protocols were accepted,无法启动代理,

报错信息

newuser@VM-16-5-ubuntu:~/jenkins_javaspace$ java -jar agent.jar -url http://127.0.0.1:5004/ -secret 409176619e18c997e2c7b97abd9ef179041c7bd19fae3d1120fed2557a5757a7 -name “java_web” -workDir “/home/newuser/jenkins_javaspace”
Jun 04, 2024 7:16:28 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/newuser/jenkins_javaspace/remoting as a remoting work directory
Jun 04, 2024 7:16:28 PM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /home/newuser/jenkins_javaspace/remoting
Jun 04, 2024 7:16:28 PM hudson.remoting.Launcher createEngine
INFO: Setting up agent: java_web
Jun 04, 2024 7:16:28 PM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 3206.vb_15dcf73f6a_9
Jun 04, 2024 7:16:28 PM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/newuser/jenkins_javaspace/remoting as a remoting work directory
Jun 04, 2024 7:16:28 PM hudson.remoting.Launcher$CuiListener status
INFO: Locating server among [http://127.0.0.1:5004/]
Jun 04, 2024 7:16:28 PM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Jun 04, 2024 7:16:28 PM hudson.remoting.Launcher$CuiListener status
INFO: Agent discovery successful
Agent address: 127.0.0.1
Agent port: 50001
Identity: db:63:3a:d4:b8:1a:c2:3f:97:85:cd:d1:27:0d:dd:f1
Jun 04, 2024 7:16:28 PM hudson.remoting.Launcher$CuiListener status
INFO: Handshaking
Jun 04, 2024 7:16:28 PM hudson.remoting.Launcher$CuiListener status
INFO: Connecting to 127.0.0.1:50001
Jun 04, 2024 7:16:28 PM hudson.remoting.Launcher$CuiListener status
INFO: Server reports protocol JNLP4-connect-proxy not supported, skipping
Jun 04, 2024 7:16:28 PM hudson.remoting.Launcher$CuiListener status
INFO: Trying protocol: JNLP4-connect
Jun 04, 2024 7:16:28 PM org.jenkinsci.remoting.protocol.impl.BIONetworkLayer$Reader run
INFO: Waiting for ProtocolStack to start.
Jun 04, 2024 7:16:28 PM hudson.remoting.Launcher$CuiListener status
INFO: Protocol JNLP4-connect encountered an unexpected exception
java.util.concurrent.ExecutionException: java.nio.channels.ClosedChannelException
at org.jenkinsci.remoting.util.SettableFuture.get(SettableFuture.java:223)
at hudson.remoting.Engine.innerRun(Engine.java:870)
at hudson.remoting.Engine.run(Engine.java:563)
Caused by: java.nio.channels.ClosedChannelException
at org.jenkinsci.remoting.protocol.ProtocolStack$Ptr.doSend(ProtocolStack.java:702)
at org.jenkinsci.remoting.protocol.ApplicationLayer.write(ApplicationLayer.java:156)
at org.jenkinsci.remoting.protocol.impl.ChannelApplicationLayer.start(ChannelApplicationLayer.java:259)
at org.jenkinsci.remoting.protocol.ProtocolStack.init(ProtocolStack.java:209)
at org.jenkinsci.remoting.protocol.ProtocolStack$Builder.build(ProtocolStack.java:563)
at org.jenkinsci.remoting.engine.JnlpProtocol4Handler.connect(JnlpProtocol4Handler.java:182)
at org.jenkinsci.remoting.engine.JnlpProtocolHandler.connect(JnlpProtocolHandler.java:157)
… 2 more

Jun 04, 2024 7:16:28 PM hudson.remoting.Launcher$CuiListener status
INFO: reconnect rejected, sleeping 10s:
java.lang.Exception: The server rejected the connection: None of the protocols were accepted
at hudson.remoting.Engine.onConnectionRejected(Engine.java:949)
at hudson.remoting.Engine.innerRun(Engine.java:896)
at hudson.remoting.Engine.run(Engine.java:563)

环境

1.宿主机和容器中jdk都是17
2.Security已设置:


其中端口为映射端口,即宿主机:容器为50001:50000
3.

可以尝试使用 websocket的链接方式

java -jar agent.jar -url https://xxxx.com/ -secret xxxxx -name test -webSocket  -workDir "/tmp"