2
\$\begingroup\$

I'm running LWJGL app on Ubuntu virtual machine with no phisical graphic card. I set up Xvfb and Mesa3D but it fails with exception

java.lang.ExceptionInInitializerError: null
        at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:234) ~[lwjgl.jar:na]
        at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:219) ~[lwjgl.jar:na]
        at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:190) ~[lwjgl.jar:na]
...
Caused by: java.lang.RuntimeException: org.lwjgl.LWJGLException: No display mode extension is available
        at org.lwjgl.opengl.Display.<clinit>(Display.java:141) ~[lwjgl.jar:na]
        ... 7 common frames omitted
Caused by: org.lwjgl.LWJGLException: No display mode extension is available
        at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:724) ~[lwjgl.jar:na]
        at org.lwjgl.opengl.Display.<clinit>(Display.java:138) ~[lwjgl.jar:na]

App is running from cron using script

export DISPLAY=localhost:1.0
export XAUTHORITY=/home/ubuntu/.Xauthority
xauth add localhost:1 . 11111111111111111111111111111111
Xvfb :1 -screen 0 1024x768x16 -nolisten tcp
/home/username/start.sh

Most of steps above were adopted from here but I'm not sure I did it correctly. Any help would be appreciated!

\$\endgroup\$
-1
\$\begingroup\$

I had a similar error when trying to run a LWJGL program remotely using VirtualGL. It can be reproduced with the GLGears demo from http://lwjgl.org/demos.php. For the test, I grabbed the files as follows:

wget http://lwjgl.org/webstart/{lwjgl_test,media}.jar
wget http://lwjgl.org/webstart/2.9.1/{lwjgl,lwjgl_util,jinput,native_linux}.jar
unzip native_linux.jar libjinput-linux64.so liblwjgl64.so

The command to run it over VGL:

vglrun java -Dorg.lwjgl.util.Debug=true \
    -Djava.library.path=$PWD \
    -cp $(echo *.jar | tr ' ' :) \
    org.lwjgl.test.opengl.Gears

This gives exactly the error you have:

Could not locate symbol glXEnumerateVideoDevicesNV
Could not locate symbol glXBindVideoCaptureDeviceNV
[LWJGL] Xrandr extension not available
[LWJGL] XF86VidMode extension not available
[LWJGL] No display mode extensions available
Exception in thread "main" java.lang.ExceptionInInitializerError
        at org.lwjgl.test.opengl.Gears.init(Gears.java:159)
        at org.lwjgl.test.opengl.Gears.execute(Gears.java:85)
        at org.lwjgl.test.opengl.Gears.main(Gears.java:76)
Caused by: java.lang.RuntimeException: org.lwjgl.LWJGLException: No display mode extension is available
        at org.lwjgl.opengl.Display.<clinit>(Display.java:141)
        ... 3 more
Caused by: org.lwjgl.LWJGLException: No display mode extension is available
        at org.lwjgl.opengl.LinuxDisplay.init(LinuxDisplay.java:724)
        at org.lwjgl.opengl.Display.<clinit>(Display.java:138)
        ... 3 more

The error comes from src/java/org/lwjgl/opengl/LinuxDisplay.java:199, it looks like it has something to do with mode extensions not being advertised by the X server:

private static int getBestDisplayModeExtension() {
    int result;
    if (isXrandrSupported()) {
        LWJGLUtil.log("Using Xrandr for display mode switching");
        result = XRANDR;
    } else if (isXF86VidModeSupported()) {
        LWJGLUtil.log("Using XF86VidMode for display mode switching");
        result = XF86VIDMODE;
    } else {
        LWJGLUtil.log("No display mode extensions available");
        result = NONE;
    }
    return result;
}

In my case, ssh -Y user@host instead of ssh -X user@host was enough to forward the RandR extension. Do this only if you trust the other host! According to this post, you can enable RandR for Xvfb with:

Xvfb +extension RANDR [further options]
\$\endgroup\$
  • \$\begingroup\$ This does not appear to be an answer to the question. Only answers should be posted in the answers section; this is not a discussion forum. \$\endgroup\$ – Josh May 3 '14 at 22:39
  • \$\begingroup\$ @JoshPetrie The answer already contained a hint, namely a mode-related issue. I've now updated it with a possible solution for OP. Hopefully you can understand that finding the root issue is one of the steps to solve a problem. \$\endgroup\$ – Lekensteyn May 4 '14 at 8:45
  • \$\begingroup\$ For those who use VirtualGL, be sure to set VGL_PROBEGLX=0 to avoid libGL error: failed to authenticate magic errors. It otherwise occurs because to the GLX extension is exposed by clients which somehow cause VirtualGL to probe for the DRI extension on the client display (e.g. SSH's localhost:13.0 instead of :1). \$\endgroup\$ – Lekensteyn May 4 '14 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.