首页 > 其他 > 详细

jvisualvm not suppout this jvm

时间:2014-02-19 08:34:58      阅读:453      评论:0      收藏:0      [点我收藏+]

Visual GC uses the jvmstat technology to gather data from the monitored application. This means that the monitored application must either run locally or there must be a jstatd agent up and running on the remote system. For remote applications added using the JMX connection you will only see the "Not supported for this JVM" message - there‘s no jvmstat available.

监控远程Java进程的JVM有两个条件:
1、应用运行在本地环境。
2、远程系统启动了jstatd agent

VisualVM监控远程JVM是通过RMI服务器来实现的,因此需要在被监控的远程服务器上启动RMI服务

需要在被监控的服务器上面,通过jstatd来启动RMI服务。
在/usr/local/java/bin/目录下新建个文件jstatd.all.policy 文件内容如下: 

# vi jstatd.all.policy
    grant codebase "file:${java.home}/../lib/tools.jar" {  
        permission java.security.AllPermission;  
    };  

然后通过执行如下的命令启动被监控服务器上的RMI服务:
# jstatd -J-Djava.security.policy=jstatd.all.policy &
如果没有添加jstatd.all.policy会报错信息:
Could not create remote object
access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write)
java.security.AccessControlException: access denied (java.util.PropertyPermission java.rmi.server.ignoreSubClasses write)
        at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
        at java.security.AccessController.checkPermission(AccessController.java:546)
        at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
        at java.lang.System.setProperty(System.java:725)
        at sun.tools.jstatd.Jstatd.main(Jstatd.java:122)
        
        
默认端口1099,可设置端口为2020
./jstatd -J-Djava.security.policy=jstatd.all.policy -p 2020 &

jstatd会跟本地的一个ip地址绑定(hostname -i显示的ip地址),可以启动时指定绑定IP:
# jstatd -J-Djava.rmi.server.hostname=192.168.1.115 -J-Djava.security.policy=jstatd.all.policy -p 11099 &

如果绑定的hostname不对可以修改:
# hostname newhostname

jvisualvm not suppout this jvm

原文:http://www.cnblogs.com/aiguang/p/3554613.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!