Bug 510

Summary: EGLDrawableFactory static initializer fails: lookupSymbolGlobal not supported on Windows (with fix)
Product: [JogAmp] Jogl Reporter: Wade Walker <wwalker3>
Component: embeddedAssignee: Sven Gothel <sgothel>
Status: VERIFIED FIXED    
Severity: normal    
Priority: ---    
Version: 2   
Hardware: pc_x86_64   
OS: windows   
Type: --- SCM Refs:
58469fd2343039c195a88d0b171ba9af2dce40be (gluegen) 2bf46093aa45a5948c200a7e83b130a636a7cd37 (jogl)
Workaround: ---

Description Wade Walker 2011-08-21 16:54:03 CEST
The recent change to EGLDynamicLibraryBundleInfo so that shallLookupGlobal()returns true causes an exception when launching an applet from within Firefox 6 and Chrome 13 on Windows. The EGLDrawableFactory static initializer fails due to lookupSymbolGlobal not being supported on Windows, so we get this stack trace from the Java console:

java.lang.ExceptionInInitializerError
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Unknown Source)
	at com.jogamp.common.util.ReflectionUtil.getClassImpl(ReflectionUtil.java:75)
	at com.jogamp.common.util.ReflectionUtil.createInstance(ReflectionUtil.java:174)
	at com.jogamp.common.util.ReflectionUtil.createInstance(ReflectionUtil.java:196)
	at javax.media.opengl.GLDrawableFactory.<clinit>(GLDrawableFactory.java:156)
	at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1201)
	at javax.media.opengl.GLProfile.access$000(GLProfile.java:71)
	at javax.media.opengl.GLProfile$1.run(GLProfile.java:112)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:110)
	at name.wadewalker.onetriangleapplet.OneTriangleApplet.init(OneTriangleApplet.java:25)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: lookupSymbolGlobal: Not supported on Windows
	at jogamp.common.os.WindowsDynamicLinkerImpl.lookupSymbolGlobal(WindowsDynamicLinkerImpl.java:71)
	at com.jogamp.common.os.NativeLibrary.dynamicLookupFunctionGlobal(NativeLibrary.java:210)
	at com.jogamp.common.os.DynamicLibraryBundle.dynamicLookupFunctionOnLibs(DynamicLibraryBundle.java:291)
	at com.jogamp.common.os.DynamicLibraryBundle.getToolGetProcAddressHandle(DynamicLibraryBundle.java:171)
	at com.jogamp.common.os.DynamicLibraryBundle.<init>(DynamicLibraryBundle.java:87)
	at jogamp.opengl.GLDynamicLookupHelper.<init>(GLDynamicLookupHelper.java:36)
	at jogamp.opengl.egl.EGLDrawableFactory.<clinit>(EGLDrawableFactory.java:74)
	... 14 more
Info: GLProfile.init - Desktop GLDrawable factory not available
java.lang.NoClassDefFoundError: Could not initialize class javax.media.opengl.GLDrawableFactory
	at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1235)
	at javax.media.opengl.GLProfile.access$000(GLProfile.java:71)
	at javax.media.opengl.GLProfile$1.run(GLProfile.java:112)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:110)
	at name.wadewalker.onetriangleapplet.OneTriangleApplet.init(OneTriangleApplet.java:25)
	at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)


If you change WindowsDynamicLinkerImpl.lookupSymbolGlobal() to the following, it fixes the problem:

    public long lookupSymbolGlobal(String symbolName) {
        if(DEBUG) {
            System.err.println("WindowsDynamicLinkerImpl.lookupSymbolGlobal: Not supported on Windows" );
        }
        return 0;
    }

More details: Java 1.6.0_23, Windows 7 64-bit, NVIDIA GeForce 8800 GTX, driver 8.17.12.7533 (5/2011).
Comment 1 Wade Walker 2011-08-21 16:56:33 CEST
Sorry, forgot to mark as confirmed. I tested the fix on FF, Chrome, Safari, and IE 9 on Windows, and they all work.

Also: isn't WindowsDynamicLinkerImpl.java supposed to be auto-generated? I looked for the .cfg file that contained the code to throw the exception, but couldn't find it. It looks like this formerly auto-generated file is now checked in?
Comment 2 Sven Gothel 2011-08-22 20:41:10 CEST
gluegen 58469fd2343039c195a88d0b171ba9af2dce40be
jogl 2bf46093aa45a5948c200a7e83b130a636a7cd37

thank you!