Can't connect TCP transport for host: localhost/127.0.0.1:4444 and Connection is refused to connect

1.2k Views Asked by At

I'm trying to verify the server health monitor for the app which is there in my local host. I'm getting below response. Please take a look into this once and help me out. In View Result tree HTTP Request showing response as 200. Application: Through Jmeter Application hosted : Java 11 Metrics: Perfmon

2021-06-16 12:47:04,032 INFO o.a.j.e.StandardJMeterEngine: Running the test!
2021-06-16 12:47:04,033 INFO o.a.j.s.SampleEvent: List of sample_variables: []
2021-06-16 12:47:04,034 INFO k.a.j.p.PerfMonCollector: PerfMon metrics will be stored in C:\Users\DELL\AppData\Local\Temp\perfmon_4504784525335490183.jtl
2021-06-16 12:47:04,038 INFO o.a.j.g.u.JMeterMenuBar: setRunning(true, *local*)
2021-06-16 12:47:04,068 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
2021-06-16 12:47:04,068 INFO o.a.j.e.StandardJMeterEngine: Starting 1 threads for group Thread Group.
2021-06-16 12:47:04,069 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
2021-06-16 12:47:04,069 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=1 ramp-up=1 delayedStart=false
2021-06-16 12:47:04,070 INFO o.a.j.t.ThreadGroup: Started thread group number 1
2021-06-16 12:47:04,070 INFO o.a.j.e.StandardJMeterEngine: All thread groups have been started
2021-06-16 12:47:04,070 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1
2021-06-16 12:47:06,002 INFO o.a.j.t.JMeterThread: Thread is done: Thread Group 1-1
2021-06-16 12:47:06,003 INFO o.a.j.t.JMeterThread: Thread finished: Thread Group 1-1
2021-06-16 12:47:06,004 INFO o.a.j.e.StandardJMeterEngine: Notifying test listeners of end of test
2021-06-16 12:47:06,006 ERROR k.a.p.c.AbstractTransport: Error during exit
java.net.SocketException: Connection reset by peer: socket write error
    at java.net.SocketOutputStream.socketWrite0(Native Method) ~[?:?]
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110) ~[?:?]
    at java.net.SocketOutputStream.write(SocketOutputStream.java:138) ~[?:?]
    at kg.apc.perfmon.client.StreamTransport.writeln(StreamTransport.java:50) ~[perfmon-2.2.2.jar:?]
    at kg.apc.perfmon.client.AbstractTransport.disconnect(AbstractTransport.java:63) [perfmon-2.2.2.jar:?]
    at kg.apc.jmeter.perfmon.NewAgentConnector.disconnect(NewAgentConnector.java:36) [jmeter-plugins-perfmon-2.1.jar:?]
    at kg.apc.jmeter.perfmon.PerfMonCollector.shutdownConnectors(PerfMonCollector.java:281) [jmeter-plugins-perfmon-2.1.jar:?]
    at kg.apc.jmeter.perfmon.PerfMonCollector.testEnded(PerfMonCollector.java:149) [jmeter-plugins-perfmon-2.1.jar:?]
    at org.apache.jmeter.reporters.ResultCollector.testEnded(ResultCollector.java:345) [ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.engine.StandardJMeterEngine.notifyTestListenersOfEnd(StandardJMeterEngine.java:218) [ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.engine.StandardJMeterEngine.run(StandardJMeterEngine.java:493) [ApacheJMeter_core.jar:5.4.1]
    at java.lang.Thread.run(Thread.java:834) [?:?]
2021-06-16 12:47:06,024 INFO o.a.j.g.u.JMeterMenuBar: setRunning(false, *local*)
2

There are 2 best solutions below

2
Dave On

What is your platform ?

If your running on Linux, its possible to find what processes have actually opened a tcp port by doing lsof -a -i4 -i6 -itcp

This will tell you what port your application has actually opened

3
Dmitri T On

JMeter PerfMon Metrics Collector is a Listener which talks to a special piece of software called PerfMon Server Agent so in order to be able to collect machine performance metrics you need to install this Server Agent onto the machine you want to monitor

  1. Download ServerAgent-x.x.x.zip
  2. Unpack it somewhere
  3. Use startAgent.bat script on Windows or startAgent.sh on Unix and derivatives to start the Server Agent
  4. That's it, you should be able to configure PerfMon Metrics Collector to query the metrics of your choice from the Server Agent

More information: How to Monitor Your Server Health & Performance During a JMeter Load Test