jmeter遇到的问题:java.net.ConnectException: Connection refused: connect

时间:2021-09-08 05:08:59

1.使用jmeter执行脚本,在察看结果树的的响应数据中看到的错误提示如下:

java.net.ConnectException: Connection refused: connect

at java.net.DualStackPlainSocketImpl.connect0(Native Method)

at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)

at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)

at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)

at java.net.AbstractPlainSocketImpl.connect(Unknown Source)

at java.net.PlainSocketImpl.connect(Unknown Source)

at java.net.SocksSocketImpl.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.connect(Unknown Source)

at java.net.Socket.<init>(Unknown Source)

at java.net.Socket.<init>(Unknown Source)

2.解决办法:

①使用ps -ef|grep httpd查看lampp有没有启动,如图表示没有启动:

jmeter遇到的问题:java.net.ConnectException: Connection refused: connect

②那么执行/opt/lampp/lampp start去开启lampp

jmeter遇到的问题:java.net.ConnectException: Connection refused: connect

③重新执行jmeter,还是报同样的错误;这是因为Apache的日志中多了一个httpd.pid的文件。

④执行killall -9 httpd,然后到lampp的logs文件夹去删除httpd.pid文件,路径是(/opt/lampp/logs/httpd.pid):

jmeter遇到的问题:java.net.ConnectException: Connection refused: connect

⑤重新启动lampp

jmeter遇到的问题:java.net.ConnectException: Connection refused: connect

⑥再次使用jmeter就ok了