Cannot run the plugin in headless mode with DISPLAY env set to something (tries to connect to a non-existant X11 server)
dmncrs opened this issue · 6 comments
Hey, my problem is that if I want to render a picture following error message comes:
"[ImageOnMap] Rendering from TheDodo24 failed: java.awt.AWTError: Can't connect to X11 window server using 'localhost:12.0' as the value of the DISPLAY variable."
Can you please help me?
I also have try to export the DISPLAY variable:
"export DISPLAY=:0"
but it doesn't changed anything
I don't have an answer right now (need to investigate) but, what is your Java version, system specs, Bukkit/Minecraft version?
Java Version: 1.8.0_191
For the server we use Paperspigot 1.12.2-R0.1-SNAPSHOT
As server we have Debian 9 on 8 CPU Cores and 24GB RAM
Ehmm ... I've something found
If I execute the command the first time after a server restart following error message comes:
"java.awt.AWTError: Can't connect to X11 window server using 'localhost:12.0' as the value of the DISPLAY variable."
And if I execute the command after the first time following error message comes:
"java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment"
In the start arguments of the server I have added following:
"-Djava.awt.headless=true"
Concerned citizen here. :)
This bug looks like ancient history and it's a duplicate of #52, so it should be closed. I recommend adding the following information to the README or other documentation:
- If you are running a server on a Linux system (e.g. a virtual private server) you probably don't have display, mouse and keyboard devices attached. You should therefore ensure that the
$DISPLAY
environment variable is unset. Useunset DISPLAY
in the shell before starting the server. - The high number in
$DISPLAY
(12 here) is usually symptomatic of logging in with SSH using X11 forwarding (i.e.ssh -X
orssh -Y
). I most cases it is unnecessary to do so, because you are only using the command line. - Background reading:
Per that documentation, defining -Djava.awt.headless=true
should be sufficient for Java's graphics APIs to degrade to a headless mode of operation. What you are seeing is probably some quirk of the version of Java you're using, or perhaps you put -Djava.awt.headless=true
after the JAR file name by mistake (in which case it would have no effect).
On Fedora Linux, with PaperSpigot 1.15.2 build 128 and openjdk version "13.0.2" 2020-01-14, I can confirm that export DISPLAY=:12.0
makes the plugin (actually Java AWT) shit itself (as expected) but also, -Djava.awt.headless=true
fixes it (also, as expected).
In my test, running unset DISPLAY
before starting the server restores normality.
Thanks you for your tips! I'll add them into the documentation as it's indeed something that can happen frequently.
Closing as duplicate of #52, but will use your last message to update the documentation :) .