Java.lang.InternalError: Unable to connect to X11 window server for JVisualVM profiling session

I have a Ubuntu ( myapp01) server VM and a Java application is deployed there. The application works, and I would like to profile it using JVisualVM. To do this, I need to install X-Windows on my Windows 7 host, and then force Ubuntu VM to export its X11 connection to my host when I tell it to run JVisualVM on the virtual machine.

So, I started by downloading XMing here:

http://sourceforge.net/projects/xming/files/Xming/6.9.0.31/Xming-6-9-0-31-setup.exe/download

I used all the standard / recommended installation options, including using a regular PuTTy session and accessing the public and private network. After installing XMing, I ran it and verified that it was running on my Windows host. Then I opened Cygwin and SSHed on an Ubuntu server:

$ ssh myuser@myapp01
myuser@myapp01 password:
Welcome to Ubuntu 12.04.4 LTS (GNU/Linux 3.5.0-23-generic x86_64)

* Documentation:  https://help.ubuntu.com/

System information as of Tue Jun 10 21:26:15 EDT 2014

System load:  0.0                Processes:           82
Usage of /:   22.5% of 11.81GB   Users logged in:     0
Memory usage: 30%                IP address for eth0: 10.10.41.108
Swap usage:   0%

    Graph this data and manage this system at:
    https://landscape.canonical.com/

38 packages can be updated.
30 updates are security updates.

Last login: Tue Jun 10 15:03:35 2014 from 10.10.101.96

, IP- :

myuser@myapp01:~$ export DISPLAY=10.10.101.96

JVisualVM:

myuser@myapp01:~$ cd $JAVA_HOME
myuser@myapp01:/usr/lib/jvm/java-7-oracle-amd64$ ls
bin  COPYRIGHT  db  include  jre  lib  LICENSE  man  README.html  release  src.zip  THIRDPARTYLICENSEREADME-JAVAFX.txt  THIRDPARTYLICENSEREADME.txt
myuser@myapp01:/usr/lib/jvm/java-7-oracle-amd64$ cd bin/
myuser@myapp01:/usr/lib/jvm/java-7-oracle-amd64/bin$ ./jvisualvm
Error: Can't connect to X11 window server using '10.10.101.96' as the value of the DISPLAY variable.
See the /home/myuser/.visualvm/7u14/var/log/messages.log for details.
myuser@myapp01:/usr/lib/jvm/java-7-oracle-amd64/bin$ vim /home/myuser/.visualvm/7u14/var/log/messages.log

/home/myuser/.visualvm/7u14/var/log/messages.log:

java.lang.InternalError: Can't connect to X11 window server using '10.10.101.96' as the value of the DISPLAY variable.
    at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
    at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
    at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:110)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:190)
    at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
    at org.netbeans.core.startup.Main.start(Main.java:200)
    at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:84)
    at java.lang.Thread.run(Thread.java:745)

? VPN, -? XMing ? export DISPLAY?

+1
3

X TCP- . X-, , , , .

SSH X11 SSH -X -Y.

Windows , $DISPLAY , xterm . $DISPLAY, , :0, localhost:0. , X, ~/.Xauthority, xauth list.

ssh -Y 10.10.101.96. X11 forwarding request failed on channel 0, ssh -v -Y 10.10.101.96, . , , , xauth . CentOS, RPM xorg-x11-xauth.

, , $DISPLAY -, SSH:

$ echo $DISPLAY
localhost:10.0

, , xterm , .

, X, X11 Java, X...

+9

Windows JDK, JVisualVM Unix XWindow ssh. , , ssh XWindow DISPLAY, cygwin XMing...

:

  • jstatd Linux ( )
  • jvisualvm Windows Linux.

(. jvisualvm jstatd )

0

. IP-, /etc/hosts , sshd.

, java , Failed to open display.

0

Source: https://habr.com/ru/post/1651731/


All Articles