轻量级xshell+manager远程监控jvisualvm
Posted 石工记
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了轻量级xshell+manager远程监控jvisualvm相关的知识,希望对你有一定的参考价值。
一、服务器端(Linux,最小安装模式,没有图形界面)
1.安装xauth
如果在Xshell中配置了X11转发后,出现如下提示:
WARNING! The remote SSH server rejected X11 forwarding request.
则需要查看/etc/ssh/sshd_config中以下选项是否为yes,
X11Forwarding yes
如果设置没问题,连接时仍报上述提示,则需要安装xauth(使用微软Azure时,最小化安装Linux,默认没有xauth)
yum install xorg-x11-xauth
2.安装xhost
如果执行xhost +命令,提示xhost命令找不到,则还需要安装xhost,否则略过此步:
[root@iZwz9fhv99le4bjulnvr1dZ ~]$ xhost + -bash: xhost: command not found
查看谁提供了xhost:
[root@iZwz9fhv99le4bjulnvr1dZ ~]$ yum provides xhost
Loaded plugins: fastestmirror, langpacks
Determining fastest mirrors
xorg-x11-server-utils-7.7-20.el7.x86_64 : X.Org X11 X server utilities
Repo : base
Matched from:
Provides : xhost = 1.0.7
从列表中选择安装:
[root@iZwz9fhv99le4bjulnvr1dZ ~]$ yum install xorg-x11-server-utils-7.7-.el7.x86_64 [root@iZwz9fhv99le4bjulnvr1dZ ~]$ xhost + access control disabled, clients can connect from any host
3.检查$DISPLAY是否有值
[root@iZwz9fhv99le4bjulnvr1dZ ~]$ echo $DISPLAY localhost:10.0
二、客户端(Windows)
1.安装Xshell
2.安装Xmanager
Xmanager会把X DISPLAY选项自动查找为Xshell
3.配置Xshell
三、使用步骤
1.Xshell连接远程服务器
2.在Xshell中启动xhost +,以便在客户端开启xserver
[root@iZwz9fhv99le4bjulnvr1dZ ~]# xhost + access control disabled, clients can connect from any host
如果客户端的xmanager没开的话,这时会发现客户端的xmanager会被拉起来了
3.在Xshell中启动jvisualvm
[root@iZwz9fhv99le4bjulnvr1dZ ~]# jvisualvm
这时会发现jvisualvm在xmanager里出现了:
四、遇到的坑
如果执行jvisualvm时,未能弹出性能监控画面,可以查看VisualVM的日志:
切换到指定日志下,查看日志内容,发现是:
java.lang.UnsatisfiedLinkError: /usr/java/jdk1..0_131/jre/lib/amd64/libawt_xawt.so: libXtst.so.6: cannot open shared object file: No such file or directory at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:) at java.lang.Runtime.load0(Runtime.java:) at java.lang.System.load(System.java:) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:) at java.lang.Runtime.loadLibrary0(Runtime.java:) at java.lang.System.loadLibrary(System.java:) at sun.awt.X11GraphicsEnvironment$.run(X11GraphicsEnvironment.java:) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:) at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:) at org.netbeans.core.startup.Main.start(Main.java:) at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:) at java.lang.Thread.run(Thread.java:)
根据提示,发现需要安装libXtst
[root@iZwz9fhv99le4bjulnvr1dZ ~]$ yum install libXtst
问题解决。
网上也有建议需要安装三个:
#yum install libXp #yum install libXt #yum install libXtst
实际运行时,发现只安装libXtst即可
5878
以上是关于轻量级xshell+manager远程监控jvisualvm的主要内容,如果未能解决你的问题,请参考以下文章