I have a java app rendering some sprites using LWJGL and OpenGL. It works fine until I move it to remote virtual machine with no phisical graphic card, Mesa 3d with related stuff is used to emulate it there. When I connect via ssh and start job manually it works fine. But running as a cron job it throws an exception
Caused by: java.lang.RuntimeException: org.lwjgl.LWJGLException: Could not open X display connection
at org.lwjgl.opengl.Display.<clinit>(Display.java:141) ~[lwjgl.jar:na]
... 7 common frames omitted
Caused by: org.lwjgl.LWJGLException: Could not open X display connection
at org.lwjgl.opengl.LinuxDisplay.openDisplay(Native Method) ~[lwjgl.jar:na]
Obviously something is wrong with X11.
Another update:
I found out it fails at the check for either Xrandr or XF86VidMode are supported. I got them installed but they kind of disabled. I tried to explicitly add RANDR but that didn't help.
xvfb-run -a '--server-args=+extension RANDR -screen 0 1024x768x16' /home/username/start.sh