jenkins jnlp奴隶代理拒绝收听端口

时间:2014-08-19 15:54:27

标签: jenkins jnlp jenkins-cli

所以我试图将我的jnlp slave代理(通过java web start)连接到我的主jenkins机器。

我已经修复了端口49187,用于jnlp slave代理的tcp连接,并且它在slave机器中打开。当我尝试连接时,它会超过握手,但随后出现以下错误:

Aug 19, 2014 3:51:10 PM com.youdevise.hudson.slavestatus.SlaveListener call
INFO: Slave-status listener starting
Aug 19, 2014 3:51:10 PM com.youdevise.hudson.slavestatus.SlaveListener$1 run
SEVERE: Could not listen on port
java.net.BindException: Address already in use: JVM_Bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(Unknown Source)
        at java.net.ServerSocket.bind(Unknown Source)
        at java.net.ServerSocket.<init>(Unknown Source)
        at java.net.ServerSocket.<init>(Unknown Source)
        at com.youdevise.hudson.slavestatus.SocketHTTPListener.waitForConnection
(SlaveListener.java:129)
        at com.youdevise.hudson.slavestatus.SlaveListener$1.run(SlaveListener.ja
va:63)
        at com.youdevise.hudson.slavestatus.Daemon.go(Daemon.java:16)
        at com.youdevise.hudson.slavestatus.SlaveListener.call(SlaveListener.jav
a:83)
        at hudson.remoting.UserRequest.perform(UserRequest.java:118)
        at hudson.remoting.UserRequest.perform(UserRequest.java:48)
        at hudson.remoting.Request$2.run(Request.java:326)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecut
orService.java:72)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source
)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at hudson.remoting.Engine$1$1.run(Engine.java:58)
        at java.lang.Thread.run(Unknown Source)

我有入境,出境亵渎,但不知道我为什么会遇到这个错误。有什么想法吗?

下面是建议答案的输出:

[root@ip-10-192-35-89 ~]# netstat -ntpl | grep 49187
tcp        0      0 :::49187                    :::*                        LISTEN      1054/java
[root@ip-10-192-35-89 ~]# ps -ef|grep 1054
jenkins   1054     1  2 Aug14 ?        02:56:02 /etc/alternatives/java -Djava.awt.headless=true -Xmx2048m -XX:MaxPermSize=512m -DJENKINS_HOME=/var/lib/jenkins -jar /usr/lib/jenkins/jenkins.war --logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war --httpPort=7777 --ajp13Port=8009 --debug=5 --handlerCountMax=100 --handlerCountMaxIdle=20
root      2483  2463  0 19:18 pts/0    00:00:00 grep 1054

2 个答案:

答案 0 :(得分:3)

从以下几行可以看出,某些进程已经在使用端口49187:

SEVERE: Could not listen on port
java.net.BindException: Address already in use: JVM_Bind

只需运行以下命令即可获取进程ID:

netstat -ntpl | grep 49187

从输出中获取process-id,然后运行以下命令以查看哪个进程正在使用端口49187.然后,您可以终止该进程并尝试连接到JNLP slave代理。

ps -ef | grep PID_from_above_output

例如,

[root@jenkins gc]# netstat -ntpl | grep 1569
tcp        0      0 127.0.0.1:25       0.0.0.0:*    LISTEN      1569/sendmail
[root@jenkins gc]#
[root@jenkins gc]# ps -ef | grep 1569
root      1569     1  0 Jun26 ?        00:01:13 sendmail: accepting connections
root      8083  8059  0 21:35 pts/0    00:00:00 grep 1569

如您所见,sendmail程序正在使用端口1569来侦听请求。

答案 1 :(得分:0)

当我发现问题所在时, JNLP Port is already in use。我尝试grepping并在jenkins master上为我们的JNLP端口执行netstat,但我从未在该特定端口上运行任何进程。似乎jenkins正在将JNLP端口信息存储在某处,并且不确定该信息。 我所做的是将JNLP端口更改为其他端口,保存了配置,尝试运行slave命令,然后再次使用相同的旧端口更新了JNLP端口,并再次重新启动了jnlp从属设备。现在可以解决任何问题。显然,当我们重新启动詹金斯母版时出现了问题。