问题描述
我在本地Windows机器上使用Java VisualVM监视远程服务器(Linux).我可以获取Bisual VM中的所有统计信息,除了" Visual GC ".它显示此JVM不支持".我用谷歌搜索它,发现可能是因为jstatd没有运行和连接.因此执行了" jstatd -J-Djava.security.policy =/tmp/tools.policy ".它显示一个ip" 175.41.139.225 ".我不明白为什么它要尝试连接到该IP.它不是我的远程计算机或本地计算机的ip.
I am using Java VisualVM on my local windows machine to monitor my remote server(Linux).I am able to get all stats in Bisual VM except "Visual GC". It shows "Not Supported for this JVM". I have googled it and find that it might be because jstatd is not running and connected. So executed "jstatd -J-Djava.security.policy=/tmp/tools.policy".It shows a ip "175.41.139.225". I can't understand why it is trying to connect to this ip. It is not the ip of my remote machine nor of my local machine.
[root@shipping_pt mail]# jstatd -J-Djava.security.policy=/tmp/tools.policy
Could not contact registry
Connection refused to host: 175.41.139.225; nested exception is:
java.net.ConnectException: Connection refused
java.rmi.ConnectException: Connection refused to host: 175.41.139.225; nested exception is:
java.net.ConnectException: Connection refused
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:619)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:216)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:202)
at sun.rmi.server.UnicastRef.newCall(UnicastRef.java:340)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:177)
at sun.tools.jstatd.Jstatd.bind(Jstatd.java:57)
at sun.tools.jstatd.Jstatd.bind(Jstatd.java:66)
at sun.tools.jstatd.Jstatd.main(Jstatd.java:143)
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:327)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:193)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:180)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
at java.net.Socket.connect(Socket.java:546)
at java.net.Socket.connect(Socket.java:495)
at java.net.Socket.<init>(Socket.java:392)
at java.net.Socket.<init>(Socket.java:206)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:40)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:146)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:613)
... 8 more
推荐答案
在远程服务器上,
vim /tmp/tools.policy
添加
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
然后启动jstatsd
And start jstatsd
jstatd -J-Djava.security.policy=/tmp/tools.policy -J-Djava.rmi.server.hostname=<public_ip>
您已经准备好在本地计算机上的VisualVM中使用Visual GC.
and you ready are with Visual GC inside VisualVM on local machine.
这篇关于无法在VisualVM中查看Visual GC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!