org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]

org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]

我正在尝试在 Linux (ubuntu 18.04) 上使用 eclipse MAT 工具并收到以下错误:

root@xxx/var/lib/jenkins/workspace/Heap_Analysis/mat# ./MemoryAnalyzer
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused
MemoryAnalyzer: Cannot open display:
MemoryAnalyzer:
An error has occurred. See the log file
/var/lib/jenkins/workspace/Heap_Analysis/mat/configuration/1614805252582.log.
root@xxxx:/var/lib/jenkins/workspace/Heap_Analysis/mat# cat /var/lib/jenkins/workspace/Heap_Analysis/mat/configuration/1614805252582.log
!SESSION 2021-03-03 21:00:52.492 -----------------------------------------------
eclipse.buildId=unknown
java.version=11.0.10
java.vendor=Ubuntu
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en
Command-line arguments:  -os linux -ws gtk -arch x86_64

!ENTRY org.eclipse.osgi 4 0 2021-03-03 21:00:53.259
!MESSAGE Application error
!STACK 1
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
        at org.eclipse.swt.SWT.error(SWT.java:4749)
        at org.eclipse.swt.widgets.Display.createDisplay(Display.java:1130)
        at org.eclipse.swt.widgets.Display.create(Display.java:1070)
        at org.eclipse.swt.graphics.Device.<init>(Device.java:175)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:636)
        at org.eclipse.swt.widgets.Display.<init>(Display.java:627)

如果你们知道任何解决问题的方法,将不胜感激。

已经解决了 Whosebug 上的所有类似问题以及以下 link: https://unix.stackexchange.com/questions/94497/org-eclipse-swt-swterror-no-more-handles-gtk-init-check-failed-while-runnin

但没有任何帮助。

我自己没见过这个问题,但是:

  1. 检查您是否安装了 libwebkit2gtk-4.0
  2. 检查 DISPLAY 设置是否正确
  3. 检查您是否可以让其他 X 应用程序正常工作
  4. 尝试最新的 Memory Analyzer 版本 1.12,因为它基于更新版本的 Eclipse,2021-06
  5. 我可以在 Windows 上 运行 Docker 下使用基于 Ubuntu 18.04 的图像进行 MAT,因此 Ubuntu 18.04 可以工作:Running MAT under Docker