Xlib: connection to "localhost:10.0" refused by server
Xlib: MobaXterm X11 proxy: Unsupported authorisation protocol
Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable.
执行xhost的结果:
Xlib: connection to "localhost:10.0" refused by server
Xlib: MobaXterm X11 proxy: Unsupported authorisation protocol
xhost: unable to open display "localhost:10.0"
以为是DISPLAY环境变量设置不对,可是与root用户同样的DISPLAY变量还是会得到同样的错误。
原来是和 X-Session security有关。以root用户执行xauth list得到一个列表:
besb01/unix:15 MIT-MAGIC-COOKIE-1 83aa78de1155733b1cefe4fc63839d1a
besb01/unix:16 MIT-MAGIC-COOKIE-1 5f6da97c370785b55288c31bc29f7b27
besb01/unix:10 MIT-MAGIC-COOKIE-1 e91f2af3747fb0095e085dcd7dd49423
besb01/unix:11 MIT-MAGIC-COOKIE-1 8037d90b9d1bf3503aaaf61c0affe4b5
besb01/unix:12 MIT-MAGIC-COOKIE-1 86667f99f925914907f12d25a6f51bc1
besb01/unix:13 MIT-MAGIC-COOKIE-1 1714acffefffd2988c4c4f1be618d9b4
besb01/unix:14 MIT-MAGIC-COOKIE-1 b16eea1237d2823f3dc9e400f123063e
复制unix:14那一行,然后以esbadmin用户执行下面的命令即可。
xauth add besb01/unix:14 MIT-MAGIC-COOKIE-1 b16eea1237d2823f3dc9e400f123063e