Runtime exception in J3D when running JOGL

Hi all,
I am trying to use one or my existing J3D loaders to load geometry using J3D classes, then process to generate a new non-J3D geometry graph for my JOGL renderer.

Problem is, it seems that even if I never do any J3D rendering, in fact the error is in a non-live setTransform call, J3D blows up on trying to load jawt.dll.

Any ideas?

java.lang.UnsatisfiedLinkError: Native Library C:\j2sdk1.4.2\jre\bin\jawt.dll already loaded in another classloader
      at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1525)
      at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1477)
      at java.lang.Runtime.loadLibrary0(Runtime.java:788)
      at java.lang.System.loadLibrary(System.java:834)
      at javax.media.j3d.MasterControl$24.run(MasterControl.java:911)
      at java.security.AccessController.doPrivileged(Native Method)
      at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:908)
      at javax.media.j3d.VirtualUniverse.<clinit>(VirtualUniverse.java:229)
      at javax.media.j3d.TransformGroupRetained.setTransform(TransformGroupRetained.java:127)
      at javax.media.j3d.TransformGroup.setTransform(TransformGroup.java:111)
      at com.imi.j3d.loaders.rtg.RtgLoader.readHierarchy(RtgLoader.java:1273)
      at com.imi.j3d.loaders.rtg.RtgLoader.loadMain(RtgLoader.java:405)
      at com.imi.j3d.loaders.rtg.RtgLoader.loadMain(RtgLoader.java:238)
      at com.imi.j3d.loaders.rtg.RtgLoader.load(RtgLoader.java:1422)
      at GearsTest$GearRenderer.init(GearsTest.java:159)
      at net.java.games.jogl.impl.GLDrawableHelper.init(GLDrawableHelper.java:68)
      at net.java.games.jogl.GLCanvas$InitAction.run(GLCanvas.java:201)
      at net.java.games.jogl.impl.windows.WindowsGLContext.makeCurrent(WindowsGLContext.java:144)
      at net.java.games.jogl.impl.windows.WindowsOnscreenGLContext.makeCurrent(WindowsOnscreenGLContext.java:110)
      at net.java.games.jogl.impl.GLContext.setRenderingThread(GLContext.java:253)
      at net.java.games.jogl.GLCanvas.setRenderingThread(GLCanvas.java:162)
      at net.java.games.jogl.Animator$1.run(Animator.java:89)
      at java.lang.Thread.run(Thread.java:534)


I moved my load call outside of the init, i.e. before GLCanvas canvas is made and it worked fine.

Still, what is the error? J3D loads jawt.dll and JOGL from different classloaders so there COULD be a conflist depending on what stage of the load the app is in?
Thanks!

What happens if you move J3D out of you ‘ext’ directory and into your normal classpath?

Actually I don’t run like that. I have several version os J3D for testign and I point the runtime enviroment all over depending what I want to test.
Also, I did try in ext as well as elsewhere.

Like I said, I just moved the load call and it worked. Since I am only doing R & D, it’s fine for now but I am curious as to why JOGL and J3D would conflict on loading jawt.dll - AWT and also why J3D loads it when I only use BranchGroup, TranformGroup and Shade3D in a non-live, non-attached scene graph.

Both Java3D and JOGL need to use jawt.dll and due to the library search path the java launcher provides it’s necessary to dynamically open jawt rather than statically link against it. To avoid writing C code to dlopen() jawt.dll, both libraries use System.loadLibrary() and there are (as you’ve found) rules about not opening the same library in two classloaders due to namespace and static variable initialization issues. Note also that JOGL now guards against the case when jawt.dll/libjawt.so is already opened; there was an issue filed about conflicts between Accessibility and JOGL (check the issue archives). Basically if you initialize Java3D first and JOGL second then things will work, as you’ve found.