[JMeter]|[JMeter] Can't accept UDP connections java.net.BindException: Address already in use_解决方案
一、问题描述
在Linux服务器(CentOS7系统)中配置并启动JMeter远程监控服务器资源所需的ServerAgent目录下的 startAgent.sh 文件时,系统出现异常提示,如下:
[root@localhost ServerAgent-2.2.3]# ./startAgent.sh
INFO2018-12-15 10:29:17.634 [kg.apc.p] (): Binding UDP to 4444
ERROR2018-12-15 10:29:17.686 [kg.apc.p] (): Can't accept UDP connections
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.DatagramChannelImpl.bind(DatagramChannelImpl.java:691)
at sun.nio.ch.DatagramSocketAdaptor.bind(DatagramSocketAdaptor.java:91)
at kg.apc.perfmon.PerfMonWorker.listenUDP(PerfMonWorker.java:144)
at kg.apc.perfmon.PerfMonWorker.startAcceptingCommands(PerfMonWorker.java:107)
at kg.apc.perfmon.AgentTool.processParams(AgentTool.java:72)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:63)
at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
二、问题分析
从以上抛出的异常信息中提取关键的提示信息:
"Can't accept UDP connections
java.net.BindException: Address already in use"
分析:ServerAgent默认开始的是4444端口,提示“不能接收UDP连接,地址已在使用中”,很可能是该端口已被占用,需要修改为新的端口号再启用or先暂停该端口对应的进程,然后再启用ServerAgent服务
三、解决方案
方式1:先暂停4444端口,再启用ServerAgent服务 查询4444端口当前对应的进程:
lsof -i:4444
[root@localhost ServerAgent-2.2.3]# lsof -i:4444
COMMANDPID USERFDTYPEDEVICE SIZE/OFF NODE NAME
java104069 root18uIPv6 39973580t0UDP *:krb524
java104069 root19uIPv6 39975490t0TCP *:krb524 (LISTEN)
关闭指定PID号码的进程(4444端口进程):
kill -9 104069
此时,亦可正常启用ServerAgent服务,如下:
[root@localhost ServerAgent-2.2.3]# kill -9 104069
[root@localhost ServerAgent-2.2.3]# lsof -i:4444
[root@localhost ServerAgent-2.2.3]# ./startAgent.sh
INFO2018-12-15 10:41:51.043 [kg.apc.p] (): Binding UDP to 4444
INFO2018-12-15 10:41:52.059 [kg.apc.p] (): Binding TCP to 4444
INFO2018-12-15 10:41:52.066 [kg.apc.p] (): JP@GC Agent v2.2.3 started
方式2:修改ServerAgent端口,再启用ServerAgent服务 ./startAgent.sh –udp-port 0 –tcp-port xxxx ("xxxx" 为新端口号,如:4567)
./startAgent.sh –udp-port 0 –tcp-port 4567
【[JMeter]|[JMeter] Can't accept UDP connections java.net.BindException: Address already in use_解决方案】参考资料:
[1] JMeter 压测Server Agent无法监控资源问题,PerfMon Metrics Collector报Waiting for sample,Error loading results file - see file log, Can't accept UDP connections java.net.BindException: Address already in use 各种疑难杂症
推荐阅读
- canvas(一)基本用法
- 190403|190403 - Jmeter压测接口
- cannot|cannot be read or is not a valid ZIP file
- vue|vue canvas 手绘进度条动画
- canvas不过如此(一)
- 运行报错Cannot|运行报错Cannot find module '@babel/compat-data/corejs3-shipped-proposals’
- HTML|HTML canvas中translate()与rotate()的理解
- (4)Canal多实例使用
- iOS|iOS -Cannot synthesize weak property because the current deployment target does n
- 跟着项目学|跟着项目学 Android Canvas