hharrison / java3d-core

Fork of the javax.media.j3d package
GNU General Public License v2.0
85 stars 39 forks source link

java.lang.NoClassDefFoundError: javax/media/nativewindow/AbstractGraphicsDevice #6

Closed heebj closed 11 years ago

heebj commented 12 years ago

Hi

Unfortunately I have a similar problem as described in http://forum.jogamp.org/NoClassDefFoundError-GLCapabilitiesChooser-on-OS-X-Snow-Leopard-and-Java-1-6-td4008344.html.

I'd like to run a java applet which uses Java3D on Mac OSX Mountain Lion.

First I got the same Exception as apoy2k: java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser

I followed the instructions and installed the following libraries: j3dcore.jar (1.6.0-pre2) j3dutils.jar (1.6.0-pre2) vecmath.jar (1.6.0-pre2)

With JOGL2-rc8 and JOGL2-rc10 I still got the following Exception:

Exception in thread "thread applet-PluginTest.class-1" java.lang.NoClassDefFoundError: javax/media/nativewindow/AbstractGraphicsDevice at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:71) at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:59) at java.security.AccessController.doPrivileged(Native Method) at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:88) at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:843) at javax.media.j3d.VirtualUniverse.(VirtualUniverse.java:274) at javax.media.j3d.Canvas3D.(Canvas3D.java:3829) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at PluginTest.init(PluginTest.java:44) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1639) at java.lang.Thread.run(Thread.java:680) Caused by: java.lang.ClassNotFoundException: javax.media.nativewindow.AbstractGraphicsDevice at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 14 more

Do you have a hint, how to solve this problem? Which versions of Java3D, JOGL and OSX are compatible with each other?

Thank you very much for your help!!

Regards Julian

hharrison commented 12 years ago

I think you must have an old Java3d somewhere in your extensions folder that is getting loaded instead of 1.6.0-pre2, which switched to using the com.jogamp versions due to changes in -rc8 of JOGL2

see: https://github.com/hharrison/java3d-core/commit/41efeba70c5d49545004f278c22590ae4158172a

So I suspect you have an old Java3d somewhere.

Harvey

heebj commented 12 years ago

Hmm, the java console says that I'm using 1.6.0-pre2:

3D [dev] 1.6.0-pre2-daily-experimental daily

java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax/media/nativewindow/AbstractGraphicsDevice at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3136) at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1497) at java.lang.Thread.run(Thread.java:680) Caused by: java.lang.NoClassDefFoundError: javax/media/nativewindow/AbstractGraphicsDevice at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:71) at javax.media.j3d.Pipeline$PipelineCreator.run(Pipeline.java:59) at java.security.AccessController.doPrivileged(Native Method) at javax.media.j3d.Pipeline.createPipeline(Pipeline.java:88) at javax.media.j3d.MasterControl.loadLibraries(MasterControl.java:843) at javax.media.j3d.VirtualUniverse.(VirtualUniverse.java:274) at ch.scs.microscopyDataCube.presentation.DataCubeView.(DataCubeView.java:34) at ch.scs.microscopyDataCube.DataCubeApplet.(DataCubeApplet.java:36) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at sun.plugin2.applet.Plugin2Manager$13.run(Plugin2Manager.java:3060) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:682) at java.awt.EventQueue.access$000(EventQueue.java:85) at java.awt.EventQueue$1.run(EventQueue.java:643) at java.awt.EventQueue$1.run(EventQueue.java:641) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:652) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) Caused by: java.lang.ClassNotFoundException: javax.media.nativewindow.AbstractGraphicsDevice at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at sun.misc.Launcher$ExtClassLoader.findClass(Launcher.java:229) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 31 more Ausnahme: java.lang.RuntimeException: java.lang.NoClassDefFoundError: javax/media/nativewindow/AbstractGraphicsDevice

hharrison commented 12 years ago

OK, is it possible you have an old JOGL somewhere in the extentions folder, I've currently only tried with JOGL2-rc8 and JOGL2-rc9....maybe you have an old JOGL1.1.1 laying about somewhere?

Maybe the following blog post will be of help:

http://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/

Good luck

heebj commented 12 years ago

My extensions folder looks as follows:

/System/Library/Java/Extensions/ AppleScriptEngine.jar dns_sd.jar gluegen-rt-natives-macosx-universal.jar gluegen-rt.jar gluegen.jar j3dcore.jar j3dutils.jar joal-natives-macosx-universal.jar jocl-natives-macosx-universal.jar jogl-all-natives-macosx-universal.jar jogl-all.jar libAppleScriptEngine.jnilib vecmath.jar

I have removed all previous files, so there should be no old JOGL...

Are there other possible locations of the old JOGL library and what would be the library's name?

I must say that I'm not a very experienced Java developer on a Mac...

Can Mountain Lion be an issue?

JohnnyO commented 12 years ago

I'm actually working on the same problem right now, trying to get an exisitng Java3D applet to run under OSX 10.8 Mountain Lion and Java 6 and encountered the same error. Were you able to figure out what was causing it?

heebj commented 12 years ago

No, unfortunately not yet...

ghost commented 12 years ago

Hi. Please could you try to run your program under Mac OS X 10.7 in order to help us to determine whether this problem has something to do with Mac OS X 10.8?

@heebj Please check that Java3D 1.5.2 (or another version) is not already installed on your Mac, don't look only at /System/Library/Java/Extensions/. I think that Harvey is right, there is a conflict with another version. Please make sure nothing prevents the classpath from being used as is. If I were you, I would not install Java3D as an extension, I would follow my tutorial. If there is still a conflict, look at which directories are included in your classpath, inspect them to find and remove any other version of Java3D, GlueGen and JOGL. Last but not least, clean your Java Web Start cache and those of your web browser; if you don't use Java3D as an extension or somewhere else, an applet using it will be forced to download it and use it, it won't use another version on your machine and it will work.

adamsamec commented 11 years ago

Hello there,

I am also experiencing these issues on Mac OS X 10.7.5. I have done plenty of tests trying to run Java applets that make use of Java3D from this page http://www.duling.us/kevin/Java3D/simple/First.html. I am pretty sure no other than intended libraries were being loaded (the only ones on my HD were residing in ~/Library/Java/Extensions/ and CLASSPATH environment variable was not set).

1) With Apple Java for OS X (Java SE 1.6.0_37) installed I got this exception:

java.lang.reflect.InvocationTargetException
    at com.sun.deploy.util.DeployAWTUtil.invokeAndWait(DeployAWTUtil.java:116)
    at sun.plugin2.applet.Plugin2Manager.runOnEDT(Plugin2Manager.java:3541)
    at sun.plugin2.applet.Plugin2Manager.createApplet(Plugin2Manager.java:3072)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Plugin2Manager.java:1497)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission accessClassInPackage.javax.media.j3d)
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:374)
    at java.security.AccessController.checkPermission(AccessController.java:549)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
    at java.lang.SecurityManager.checkPackageAccess(SecurityManager.java:1512)
    at sun.plugin2.applet.Applet2SecurityManager.checkPackageAccess(Applet2SecurityManager.java:287)
    at java.lang.ClassLoader$1.run(ClassLoader.java:330)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.lang.ClassLoader.checkPackageAccess(ClassLoader.java:328)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
    at java.lang.Class.getConstructor0(Class.java:2699)
    at java.lang.Class.newInstance0(Class.java:326)
    at java.lang.Class.newInstance(Class.java:308)
    at sun.plugin2.applet.Plugin2Manager$13.run(Plugin2Manager.java:3060)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:702)
    at java.awt.EventQueue.access$400(EventQueue.java:82)
    at java.awt.EventQueue$2.run(EventQueue.java:663)
    at java.awt.EventQueue$2.run(EventQueue.java:661)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:672)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Exception: java.lang.reflect.InvocationTargetException

This exception was occurring with Java3D 1.6.0-pre3* + JOGL from 2.0-rc08 to 2.0-rc11 or latest automatic build of JOGL 2.0 (b857 was tested) with GlueGen 2.0 (b608 was tested) or http://jogamp.org/deployment/jogamp-current/archive/jogamp-all-platforms.7z . Also Java3D 1.6.0-pre1/1.5.2/1.5.1/1.5.0 + JOGL 1.1.1a with GlueGen 1.0b6 did the same as would probably do other combinations.

2) With Oracle JRE 7 (Java SE 7 Update 09) installed I got one of these exceptions:

java.lang.NoClassDefFoundError: Could not initialize class javax.media.j3d.VirtualUniverse (happened always after applet reload or page refresh no matter what combination of Java3D + JOGL was used)
java.lang.NoClassDefFoundError: javax/media/nativewindow/CapabilitiesImmutable (Java3D 1.5.0/1.6.0-pre3* + JOGL 2.0-rc11/-rc08)
java.lang.NoClassDefFoundError: javax/media/opengl/GLException (Java3D 1.6.0-pre1/1.5.2 + JOGL 2.0-rc11/-rc08)
java.lang.NoClassDefFoundError: javax/media/opengl/GLCapabilitiesChooser (Java3D 1.5.2/1.5.1 + JOGL 2.0-rc11)
java.lang.NoClassDefFoundError: javax/media/opengl/GLDrawable (Java3D 1.5.0/1.6.0-pre1 + JOGL 2.0-rc11/-rc08)
java.lang.NoClassDefFoundError: javax/media/opengl/GL (Java3D 1.5.0/1.6.0-pre3* + JOGL 2.0-rc11/-rc08)
java.lang.NoClassDefFoundError: javax/media/opengl/AbstractGraphicsDevice (Java3D 1.6.0-pre1/1.5.2/1.5.1/1.5.0 + jogamp-all-platforms.7z/JOGL 2.0-b857 with GlueGen 2.0-b608)

These were occurring quite at random but to some extent depending on which combination of Java3D + JOGL was used (as decribed in parenthesis, but this is not exhaustive list of combinations in which they occurred).

The only combinations that didn't throw an exception were:


I can only confirm that JOGL examples from http://jogamp.org/deployment/jogamp-next/jogl-test-applets.html which use .jar files hosted at http://jogamp.org/deployment/jogamp-next/jar/ (jogamp-next is currently alias for v2.0-rc11) are working fine on OS X 10.7.5 (Safari, Firefox and Opera) with Apple JRE 6 and Oracle JRE 7 too.


*the Java3D 1.6.0-pre3 I am referring to is @hharrison's fork from this github.

hharrison commented 11 years ago

Could you please submit this on the java3d forum over at jogamp, that will have a much wider audience (ie, more than just me)

http://forum.jogamp.org/

Thanks

ghost commented 11 years ago

@adamsamec Don't rely on ~/Library/Java/Extensions/, just use the classpath (not an environment variable), it's a cleaner approach. There is absolutely no bug in my humble opinion.

goose121 commented 10 years ago

When looking at the structure of the jar file, it turns out that the developers thought that AbstractGraphicsDevice was in the package nativewindow, but in reality, it is in the opengl package, so the code inevitably cannot find it.

ghost commented 10 years ago

@kman14367 Please be more accurate. AbstractGraphicsDevice is within JOGL, in jogl-all.jar. Please follow my instructions and don't rely on any extension folder: http://gouessej.wordpress.com/2012/08/01/java-3d-est-de-retour-java-3d-is-back/