VisualVM over ssh

2020-01-26 18:54发布

I've read Visual VM remotely over ssh but I think I've not fully understood because it was not working for me :-( Please can someone give some example?

ssh -D 9696 login@ip.of.external.machine and visualvm.exe -J-Dnetbeans.system_socks_proxy=localhost:9696 -J-Djava.net.useSystemProxies=true starts visualvm, but no processes of external machine are shown (only the local ones like visualvm itself). Moreover sometimes (but not always) I got the message "channel 3: open failed: connect failed: Connection refused" in my ssh window.

Any help?

标签: ssh visualvm
8条回答
叼着烟拽天下
2楼-- · 2020-01-26 19:48

I had the issue of jstatd binding on localhost, so i had to type

jstatd -J-Djava.security.policy=allPerm.policy -J-Djava.rmi.server.logCalls=true -p <port> -J-Djava.rmi.server.hostname=<my ip>

also for jvisualvm i use this parameters instead

jvisualvm -J-DsocksProxyHost=localhost -J-DsocksProxyPort=<socks-port>

this way, connecting by the ssh proxy, i could use the real ip address of my remote machine.

Stealing from this answer i made myself a full reminder on my site .. i hope you don't mind ankon Thanks for this by the way :)

查看更多
对你真心纯属浪费
3楼-- · 2020-01-26 19:48

I was having the same issue while connecting jVisualVM to a remote application over ssh.

This Tutorial helped me solve my issue. http://issamben.com/how-to-monitor-remote-jvm-over-ssh/

To solve this issue make sure :

  • you set two port in the jvm configuration

     -Dcom.sun.management.jmxremote.ssl=false 
     -Dcom.sun.management.jmxremote.authenticate=false 
     -Dcom.sun.management.jmxremote.port=9010
     -Dcom.sun.management.jmxremote.rmi.port=9011
     -Djava.rmi.server.hostname=localhost
     -Dcom.sun.management.jmxremote.local.only=false
    
  • ssh tunnel is properly established

     ssh -i yourPermissionFile.pem -l username 101.101.101.101 -L 9010:localhost:9010 -L 9011:localhost:9011
    
查看更多
登录 后发表回答