Bug 505

Summary: Applets won't work on recall of page [firefox, chrome, safari, IE,..] [Windows, Linux, ..]
Product: [JogAmp] Jogl Reporter: luc bonade <btarba2001>
Component: appletAssignee: Sven Gothel <sgothel>
Status: VERIFIED FIXED    
Severity: blocker CC: sgothel, wwalker3
Priority: P1    
Version: 2   
Hardware: pc_all   
OS: all   
Type: --- SCM Refs:
919aabb77250cb0e272dac228388592d08bf98f5 b6aa455d21fbcfc256ae8f8f4d66493c17e23f4c
Workaround: ---

Description luc bonade 2011-07-11 11:31:08 CEST
I have build an applet with jogl 2.

It works fine with jnpl launch with Chrome, IE, and FireFox an Windows 32 bits and Windows post XP.

But With Safari on windows jnpl launch fails so i use JOGL Applet Launcher.
ON a first display of the page it works fine, but if you call the page later (without closing the navigator). The launch fail.

The bug also exist with the Demo applet :
http://jogamp.org/jogl-demos/www/applettest-jnlp.html
If you call a refresh of the page it works but if you call an other page and call the applet page next it fails.

The error from the applet viewer if the following :
Sorry its the full console output from the execution

JNLPAppletLauncher: static initializer
java.net.MalformedURLException: no protocol: 
	at java.net.URL.<init>(Unknown Source)
	at java.net.URL.<init>(Unknown Source)
	at java.net.URL.<init>(Unknown Source)
	at sun.plugin.liveconnect.SecureInvocation.checkLiveConnectCaller(Unknown Source)
	at sun.plugin.liveconnect.SecureInvocation.access$000(Unknown Source)
	at sun.plugin.liveconnect.SecureInvocation$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin.liveconnect.SecureInvocation.CallMethod(Unknown Source)
GearsApplet: init() - begin
GearsApplet: init() - end
GearsApplet: start() - begin
GearsApplet: start() - end
Gears: Init: AWT-GLCanvas[Realized true,
	jogamp.opengl.windows.wgl.WindowsOnscreenWGLDrawable,
	Realized true,
	Factory   jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory@97eded,
	handle    0x2f01198d,
	Drawable size 600x400,
	AWT pos 0/0, size 600x400,
	visible true,
	AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type AWT[subType null], connection \Display0, unitID 0, awtDevice D3DGraphicsDevice[screen=0], handle 0x0], idx 0],
	chosen    GLCaps[7 arb: on-scr, rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms: 24/0/0, dbl, mono  , hw, GLProfile[GL3bc/GL3bc]],
	requested GLCaps[on-scr, rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms: 16/0/0, dbl, mono  , hw, GLProfile[GL3bc/GL3bc]],
	sun.awt.Win32GraphicsConfig@97d01f[dev=D3DGraphicsDevice[screen=0],pixfmt=7],
	encapsulated WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type Windows, connection decon, unitID 0, handle 0x0], idx 0], pfdID 7, ARB-Choosen true,
	requested GLCaps[on-scr, rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms: 16/0/0, dbl, mono  , hw, GLProfile[GL3bc/GL3bc]],
	chosen    GLCaps[7 arb: on-scr, rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms: 24/0/0, dbl, mono  , hw, GLProfile[GL3bc/GL3bc]]]]]
Chosen GLCapabilities: GLCaps[7 arb: on-scr, rgba 8/8/8/0, opaque, accum-rgba 16/16/16/16, dp/st/ms: 24/0/0, dbl, mono  , hw, GLProfile[GL3bc/GL3bc]]
INIT GL IS: jogamp.opengl.gl4.GL4bcImpl
GL_VENDOR: NVIDIA Corporation
GL_RENDERER: GeForce 9600 GT/PCI/SSE2
GL_VERSION: 3.3.0
Gears: Reshape: 0/0 600x400
GearsApplet: stop() - begin
GearsApplet: stop() - end
GearsApplet: destroy() - X
Gears: Dispose
GearsApplet: init() - begin
javax.media.opengl.GLException: Surface not ready (lockSurface)
	at jogamp.opengl.windows.wgl.WindowsWGLGraphicsConfigurationFactory.preselectGraphicsConfiguration(WindowsWGLGraphicsConfigurationFactory.java:227)
	at jogamp.opengl.windows.wgl.WindowsWGLGraphicsConfiguration.preselectGraphicsConfiguration(WindowsWGLGraphicsConfiguration.java:148)
	at jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:125)
	at javax.media.nativewindow.GraphicsConfigurationFactory.chooseGraphicsConfiguration(GraphicsConfigurationFactory.java:240)
	at javax.media.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:978)
	at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:517)
	at java.awt.Container.addImpl(Unknown Source)
	at java.awt.Container.add(Unknown Source)
	at demos.applets.GearsApplet.init(GearsApplet.java:24)
	at org.jdesktop.applet.util.JNLPAppletLauncher.startSubApplet(JNLPAppletLauncher.java:1987)
	at org.jdesktop.applet.util.JNLPAppletLauncher.access$200(JNLPAppletLauncher.java:661)
	at org.jdesktop.applet.util.JNLPAppletLauncher$5.run(JNLPAppletLauncher.java:1324)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$000(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
java.net.MalformedURLException: no protocol: 
	at java.net.URL.<init>(Unknown Source)
	at java.net.URL.<init>(Unknown Source)
	at java.net.URL.<init>(Unknown Source)
	at sun.plugin.liveconnect.SecureInvocation.checkLiveConnectCaller(Unknown Source)
	at sun.plugin.liveconnect.SecureInvocation.access$000(Unknown Source)
	at sun.plugin.liveconnect.SecureInvocation$2.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.plugin.liveconnect.SecureInvocation.CallMethod(Unknown Source)
Comment 1 Wade Walker 2011-08-21 17:28:51 CEST
I confirm similar behavior on Windows 7 64-bit with Safari 5.1. I get this error when I open a new tab and try to launch the applet again, or when I reload the applet twice (the first reload works OK, for some reason):

javax.media.opengl.GLException: Surface not ready (lockSurface)
	at jogamp.opengl.windows.wgl.WindowsWGLGraphicsConfigurationFactory.preselectGraphicsConfiguration(WindowsWGLGraphicsConfigurationFactory.java:239)
	at jogamp.opengl.windows.wgl.WindowsWGLGraphicsConfiguration.preselectGraphicsConfiguration(WindowsWGLGraphicsConfiguration.java:151)
	at jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:125)
	at javax.media.nativewindow.GraphicsConfigurationFactory.chooseGraphicsConfiguration(GraphicsConfigurationFactory.java:240)
	at javax.media.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1004)
	at javax.media.opengl.awt.GLCanvas.addNotify(GLCanvas.java:528)
	at java.awt.Container.addImpl(Unknown Source)
	at java.awt.Container.add(Unknown Source)
	at name.wadewalker.onetriangleapplet.OneTriangleApplet.init(OneTriangleApplet.java:51)
	at org.jdesktop.applet.util.JNLPAppletLauncher.startSubApplet(JNLPAppletLauncher.java:1992)
	at org.jdesktop.applet.util.JNLPAppletLauncher.access$200(JNLPAppletLauncher.java:662)
	at org.jdesktop.applet.util.JNLPAppletLauncher$5.run(JNLPAppletLauncher.java:1326)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.awt.EventQueue.access$000(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.awt.EventQueue$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Comment 2 Sven Gothel 2011-08-22 20:42:56 CEST
Reminds me of the same behavior of one of this/last years JRE on GNU/Linux + FF,
which exposed the same behavior if you pressed 'reload'.
Comment 3 Sven Gothel 2011-11-21 14:22:34 CET
IFF 'Surface not ready" is caused by "java.net.MalformedURLException: no protocol: ",
this must be a Safari/Plugin bug .. since the 1st start works fine. 
The same bug exist[ed] on Linux w/ FF a while ago .. and is fixed in the plugin code and/or FF, dunno.
?
Comment 4 Sven Gothel 2011-11-29 18:42:31 CET
I could reproduce similar bugs w/ Safari and even Chrome (w/ NEWT/Applet).

Working on it .. while validating Applet support for all platforms.
Comment 5 Sven Gothel 2011-11-30 16:55:39 CET
Even though commits:
  ad0ba11b0a1d6cb4a113e467420f2f797f1d26cb
  77e9d16a3ad5131a2197bb3cad2309827c3a796a

Make the NEWT/Applets work already on Windows (all browsers),
the AWT/Applet doesn't [recall issue].

Also the lifecycle reset (init/shutdown) w/ Applet's [init/destroy]
currently confuses Linux/X11.

I currently complete the lifecycle of JOGL/Gluegen.

This is the current 'static' initialization sequence:
- GLProfile
    - Platform
        - JVMUtil
        - JNILibLoaderBase
        - TempJarCache

    - NativeWindowFactory
        - X11Util

    - GLDrawableFactory / GLDrawableFactoryImpl
        - X11GLXDrawableFactory / ... (all platforms)
        - EGLDrawableFactory

    - GLContext (context version mapping)

shutdown() shall ensure that no resources are bound,
as well as the next initialization properly works.
Comment 6 Sven Gothel 2011-12-01 21:55:20 CET
Shutdown Sequence:
http://jogamp.org/git/?p=jogl.git;a=commit;h=919aabb77250cb0e272dac228388592d08bf98f5
http://jogamp.org/git/?p=jogl.git;a=commit;h=b6aa455d21fbcfc256ae8f8f4d66493c17e23f4c

(and actually a few more commit, cleaning up / review result - notably GlueGen TempJarCache)

[1] Windows 7 x64 Native/NV, VirtualBox 4.1.6/Chromium(NV):
[2] Linux x64 [ubuntu 10/11]
[3] MacOSX 10.7

  Tested:
    - AWT Applet w/ GLCanvas (VersionApplet)
    - NEWT Applet w/ GLWindow (JOGLNewtApplet1Run)
    - NApplet OK
    - LApplet OK
    - JApplet/Dual OK
    - back/fwd (reload) works

  Browser:
    - Internet Explorer [8 and 9] 32bit [1]
    - Safari 5.1.1 32bit [1], [3]
    - Firefox [6.0, 8.0.1] 32bit, [11.0a1] 64bit [1], [2], [3]
    - Chrome [15.0.874.121m, 16.0.912.41] 32bit [1], [2]
Comment 7 Sven Gothel 2011-12-02 07:56:36 CET
manually verified