arthas icon indicating copy to clipboard operation
arthas copied to clipboard

java.net.ConnectException: Connection refused: connect

Open byposeidon opened this issue 3 years ago • 3 comments

Connect to telnet server error: 127.0.0.1 3658 java.net.ConnectException: Connection refused: connect.

Interestingly it works on some jar files. But in most applications I get the above error. Even in the arthas-demo.jar file. I tested with 4 different java versions. I restarted the process multiple times.

I am using Windows OS and firewall is turned off.

There are hundreds of people getting this error. Why is root not explored?

byposeidon avatar Oct 11 '22 11:10 byposeidon

  1. When arthas starts successfully, it will listen to port 3658 in the application process.

  2. Then arthas-boot will try to connect to port 3658 with telnet.

If in step 1, starting the arthas agent fails, it will Connection refused in step 2.

So check ~/logs/arthas/arthas.log why the arthas agent failed to start.

hengyunabc avatar Oct 11 '22 11:10 hengyunabc

[INFO] Try to attach process 22568 Picked up JAVA_TOOL_OPTIONS: [ERROR] Start arthas failed, exception stack trace: com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded at sun.tools.attach.LinuxVirtualMachine.(LinuxVirtualMachine.java:106) at sun.tools.attach.LinuxAttachProvider.attachVirtualMachine(LinuxAttachProvider.java:78) at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:250) at com.taobao.arthas.core.Arthas.attachAgent(Arthas.java:102) at com.taobao.arthas.core.Arthas.(Arthas.java:27) at com.taobao.arthas.core.Arthas.main(Arthas.java:161) [INFO] Attach process 22568 success. [INFO] arthas-client connect 127.0.0.1 3658 Connect to telnet server error: 127.0.0.1 3658 java.net.ConnectException: Connection refused (Connection refused) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:607) at org.apache.commons.net.SocketClient.connect(SocketClient.java:188) at org.apache.commons.net.SocketClient.connect(SocketClient.java:209) at com.taobao.arthas.client.TelnetConsole.process(TelnetConsole.java:306) at com.taobao.arthas.client.TelnetConsole.main(TelnetConsole.java:166) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.taobao.arthas.boot.Bootstrap.main(Bootstrap.java:624)

zinking avatar Oct 13 '22 12:10 zinking

@zinking https://arthas.aliyun.com/doc/faq.html#target-process-not-responding-or-hotspot-vm-not-loaded

hengyunabc avatar Oct 14 '22 02:10 hengyunabc