Need help getting Xith3D and JOGLAppletLauncer to cooperate

Hi everyone.

I lost my Java3D, Xith3D and JOGL virginity just 2 days ago so I’m still pretty mystified and I’m definitly still having a hard time keeping apart what concepts actually belongs to Xith3D and what belongs to JOGL. So a big newbie warning is in order.

I put together a little application based on the AseTest, pretty much only changing a few settings and replacing the tank with a .3DS model. This worked just fine and I was very impressed with the whole experience.

But now the problems begin. I’m trying to turn it into an applet. So I got ahold of the JOGLAppletLauncher which as I understand it belongs to a newer version of JOGL referred to as JSR231. It successfully deals with the native jogl files but once it starts my applet, it starts to complain. On this line to be exact:

CanvasPeer cp = rp.makeCanvas(panel, 450, 500, 32, false);

I tried to follow a JSR231 tutorial which created a JOGL applet which used the GLCanvas and everything worked just fine. But I’m having no luck combining the success of the 2; making my Xith3D applet use the newer JOGL and launch using the JOGLAppletLauncher.

I’m really at a loss right now, any pointers would be greatly appreciated.

And one more thing; Will future Xith3D releases, once it’s switched over to JSR231, include the JOGLAppletLauncher?

Updated to Xith3D 0.7 but the problem remain…

Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: net/java/games/jogl/GLEventListener
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(Unknown Source)
	at java.security.SecureClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.defineClass(Unknown Source)
	at java.net.URLClassLoader.access$000(Unknown Source)
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at sun.applet.AppletClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at sun.applet.AppletClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	at com.xith3d.render.jogl.RenderPeerImpl.makeCanvas(RenderPeerImpl.java:145)
	at com.xith3d.render.jogl.RenderPeerImpl.makeCanvas(RenderPeerImpl.java:126)
	at com.xith3d.render.jogl.RenderPeerImpl.makeCanvas(RenderPeerImpl.java:111)
	at dvdcase.DVDApplet.init(DVDApplet.java:76)
	at com.sun.opengl.util.JOGLAppletLauncher.startSubApplet(JOGLAppletLauncher.java:711)
	at com.sun.opengl.util.JOGLAppletLauncher.access$700(JOGLAppletLauncher.java:117)
	at com.sun.opengl.util.JOGLAppletLauncher$2.run(JOGLAppletLauncher.java:675)
	at java.awt.event.InvocationEvent.dispatch(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)

I haven’t checked the latest xith builds, but you seem to use the wrong peer implementation : the package should be com.xith3d.render.jsr231 (at least it’s what I have here).

Lilian :slight_smile:

Thanks for the help Lilian,
I must be missing some JAR in my project though, cause now I’m getting a new exception on the same line.

java.lang.NoClassDefFoundError: com/sun/opengl/util/BufferUtil
        at com.xith3d.render.jsr231.ShapeAtomPeer.<init>(ShapeAtomPeer.java:660)
        at com.xith3d.render.jsr231.RenderPeerImpl.<init>(RenderPeerImpl.java:63)
        at dvdcase.DVDApplet.init(DVDApplet.java:76)
        at sun.applet.AppletPanel.run(AppletPanel.java:417)
        at java.lang.Thread.run(Thread.java:626)

Yes indeed. You don’t have jogl.jar in your classpath.
Please download the JSR-231 here : https://jogl.dev.java.net/

Ok, I’m confused…

I do have JOGL in my classpath, the one that’s included in the third-party distribution. Hasn’t that been updated to include the JSR231 version as of Xith3D 0.7?

Ahem… I’m afraid it wasn’t.
That’s my fault. That will be fixed in Xith 0.7.1

Ah, thanks for clearing that up :slight_smile:

I’ve now made Release notes : http://www.java-gaming.org/forums/index.php?topic=13405.0 where I explicit clearly you need to download the JSR-231.

Thanks for pointing that out, sialivi !

You almost make it sound like I know what I’m doing :wink:

On to my next problem. This only appear with my Xith3D applet, my non-Xith3D jogl applet doesn’t seem to have this problem with accessing user.home

java.security.AccessControlException: access denied (java.util.PropertyPermission user.home read)
	at java.security.AccessControlContext.checkPermission(Unknown Source)
	at java.security.AccessController.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
	at java.lang.System.getProperty(Unknown Source)
	at com.sun.opengl.util.JOGLAppletLauncher.start(JOGLAppletLauncher.java:288)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

That was when running it from a browser. Running it from the appletviewer on the other hand gives me something completly different:

Exception in thread "Thread-4" Exception in thread "AWT-EventQueue-1" javax.media.opengl.GLException: Attempt to make the same context current twice on thread Thread[AWT-EventQueue-1,4,file:E:/opt/java/ivilsoft/DVDCase/build/classes/-threadGroup]
        at com.sun.opengl.impl.GLContextLock.lock(GLContextLock.java:83)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:115)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:258)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
        at javax.media.opengl.GLCanvas.paint(GLCanvas.java:142)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:288)
        at java.awt.Component.dispatchEventImpl(Component.java:4454)
        at java.awt.Component.dispatchEvent(Component.java:4208)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
javax.media.opengl.GLException: java.lang.UnsatisfiedLinkError: no jogl_awt in java.library.path
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:266)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:256)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:130)
        at com.xith3d.render.jsr231.CanvasPeerImpl.render(CanvasPeerImpl.java:1207)
        at com.xith3d.scenegraph.View.renderOnce(View.java:616)
        at com.xith3d.scenegraph.View.renderOnce(View.java:549)
        at dvdcase.DVDApplet.run(DVDApplet.java:207)
        at java.lang.Thread.run(Thread.java:626)
Caused by: java.lang.UnsatisfiedLinkError: no jogl_awt in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
        at java.lang.Runtime.loadLibrary0(Runtime.java:821)
        at java.lang.System.loadLibrary(System.java:1030)
        at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.java:78)
        at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:101)
        at com.sun.opengl.impl.NativeLibLoader.access$100(NativeLibLoader.java:47)
        at com.sun.opengl.impl.NativeLibLoader$2.run(NativeLibLoader.java:130)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.sun.opengl.impl.NativeLibLoader.loadAWTImpl(NativeLibLoader.java:116)
        at com.sun.opengl.impl.JAWT.getJAWT(JAWT.java:91)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:162)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:118)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:298)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

There are security issues you have to think about when using joglappletlauncher : the jogl.jar and its natives are signed with sun’s trusted certificate, meaning they can do whatever they want on the client side (like creating their own cache for libraries).

usually, your own jar files won’t be signed (so the user won’t have to accept your usually self signed (untrusted) jars) and you have to take it into account (accessing user.home and many other system properties is forbidden). other limited accesses are file io, network connections with other computers (except the one used for downloading the jar files)…

If you really need to access these secured features, then you’ll have to sign your jars (at the risk of scaring the player away).

Hope it helps !

Lilian :slight_smile:

But I’m not using any security features. The only security related thing is using the JOGLAppletLauncher to install the native libs, but that’s not my code, and the JOGLAppletLauncher worked just fine when I used it to launch a non-xith3d jogl applet. I don’t see what’s different now.

then you must be using an unsigned version of jogl.jar (only official releases are signed, not nightly builds)

Lilian :slight_smile:

Aaaah, you’re right. This is a nightly. Thanks alot :slight_smile:

Almost starts now :slight_smile:

Exception in thread "AWT-EventQueue-3" java.lang.ExceptionInInitializerError
	at com.xith3d.render.RenderOptions.<init>(RenderOptions.java:67)
	at com.xith3d.render.CanvasPeerBase.<init>(CanvasPeerBase.java:63)
	at com.xith3d.render.jsr231.CanvasPeerImpl.<init>(CanvasPeerImpl.java:139)
	at com.xith3d.render.jsr231.RenderPeerImpl.makeCanvas(RenderPeerImpl.java:147)
	at com.xith3d.render.jsr231.RenderPeerImpl.makeCanvas(RenderPeerImpl.java:128)
	at com.xith3d.render.jsr231.RenderPeerImpl.makeCanvas(RenderPeerImpl.java:113)
	at dvdcase.DVDApplet.init(DVDApplet.java:78)
	at com.sun.opengl.util.JOGLAppletLauncher.startSubApplet(JOGLAppletLauncher.java:721)
	at com.sun.opengl.util.JOGLAppletLauncher.access$700(JOGLAppletLauncher.java:117)
	at com.sun.opengl.util.JOGLAppletLauncher$2.run(JOGLAppletLauncher.java:685)
	at java.awt.event.InvocationEvent.dispatch(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)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission XITH3D_USE_SHADOWS read)
	at java.security.AccessControlContext.checkPermission(Unknown Source)
	at java.security.AccessController.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPermission(Unknown Source)
	at java.lang.SecurityManager.checkPropertyAccess(Unknown Source)
	at java.lang.System.getProperty(Unknown Source)
	at com.xith3d.render.Option.<init>(Option.java:93)
	at com.xith3d.render.Option.<clinit>(Option.java:182)
	... 18 more

My fault : i forgot to declare this bug : in my codebase, i’ve surrounded the System.getProperty(…) by a try/catch to ignore it.

(This should be added in the official xith build)

Lilian :slight_smile:

Guess I’ll have to grab the source and do that as well then. Which file is that in?

xith core : com.xith3d.render.Option.(Option.java:93) (constructor)

Lilian

@sialivi : have you fixed your GLException ? I saw TheFieryShadow has the same bug and I don’t know where it comes from.

Hmm… It doesn’t affect the behavior of others renderers ? If yes, I can add it.