[RE-OPEN] UnsatisfiedLinkError: jogamp.nativewindow.jawt

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[RE-OPEN] UnsatisfiedLinkError: jogamp.nativewindow.jawt

Gaël
This post was updated on .
Hello,

I'm working on an eclipse plugin with tycho that is a maven plugin, binding maven pom approach and OSGI manifest approach.
Tell you that cause i already had problem with natives libraries.
Jogamp is a dependency of a third-party (jogl-all-main and gluegen-rt-main) and it couldn't automaticaly resolve them, so I think my problem may be relative to this config.
 
Anyway, now the required nat libs for jogamp(2.0.0rc11) are successfully loaded. I unziped all jars containing the nat libs in a folder in my jar then expose it in java.library.path

Now working with my third-party, Jzy3D, I have the following stacktrace :

java.lang.UnsatisfiedLinkError: jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT1(Ljava/nio/ByteBuffer;)Z
        at jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT1(Native Method)
        at jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT(JAWTFactory.java:37)
        at jogamp.nativewindow.jawt.JAWT$1.run(JAWT.java:106)
        at jogamp.nativewindow.jawt.JAWT$1.run(JAWT.java:103)
        at java.security.AccessController.doPrivileged(Native Method)
        at jogamp.nativewindow.jawt.JAWT.getJAWT(JAWT.java:103)
        at jogamp.nativewindow.jawt.JAWTUtil.getJAWT(JAWTUtil.java:166)
        at jogamp.nativewindow.jawt.JAWTUtil.<clinit>(JAWTUtil.java:192)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at javax.media.nativewindow.NativeWindowFactory$2.run(NativeWindowFactory.java:232)
        at javax.media.nativewindow.NativeWindowFactory$2.run(NativeWindowFactory.java:229)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.nativewindow.NativeWindowFactory.initSingleton(NativeWindowFactory.java:229)
        at javax.media.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1368)
        at javax.media.opengl.GLProfile.access$100(GLProfile.java:76)
        at javax.media.opengl.GLProfile$1.run(GLProfile.java:157)
        at java.security.AccessController.doPrivileged(Native Method)
        at javax.media.opengl.GLProfile.initSingleton(GLProfile.java:123)

I'm sur that the libs are ok with the jogamp version.

I can't figure out why it throws this error, help would be really appreciate.

Thank in advance.
Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

gouessej
Administrator
Hi

We only support the very latest version of JOGL (2.3.2 currently) and I doubt that any decent version of Jzy3D relies on a so old version of JOGL.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

Gaël
However i download Jzy3D from http://www.jzy3d.org/ and latest version seems to be 0.9.1
I would use latest version of JOGL but here is the relevant part of the pom of jzy3d-api :

<dependencies>
        <dependency>
                        <groupId>org.jzy3d</groupId>
                        <artifactId>jzy3d-jdt-core</artifactId>
                        <version>0.9.1</version>
                </dependency>

                <dependency>
                        <groupId>org.jogamp.gluegen</groupId>
                        <artifactId>gluegen-rt-main</artifactId>
                        <version>2.0-rc11</version>
                </dependency>
                <dependency>
                        <groupId>org.jogamp.jogl</groupId>
                        <artifactId>jogl-all-main</artifactId>
                        <version>2.0-rc11</version>
                </dependency>

Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

gouessej
Administrator
The version on Github requires JOGL 2.1.5. You should contact the author of Jzy3d so that he updates his library to support JOGL 2.3.2. I'd like him to release a minor version supporting the latest version of JOGL.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

Gaël
I contacted him.
FYI here is his answer : https://groups.google.com/forum/#!topic/jzy3d/tnd3J92Gmq4
Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

gouessej
Administrator
I think that there might be some troubles specific to OS X with AWT and/or NEWT.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

Gaël
I re-open this post because I'm now working with jogl 2.3.2
I have a custom loader for the nat libs so I loaded just those i needed for my win64 os.
I take them from jogl & gluegen windows-amd64_2.3.2.jar

I still have this error :
java.lang.UnsatisfiedLinkError: jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT1(Ljava/nio/ByteBuffer;)Z
        at jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT1(Native Method)
        at jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT(JAWTFactory.java:70)
        at jogamp.nativewindow.jawt.JAWT$1.run(JAWT.java:111)
        at jogamp.nativewindow.jawt.JAWT$1.run(JAWT.java:108)
        at java.security.AccessController.doPrivileged(Native Method)
        at jogamp.nativewindow.jawt.JAWT.getJAWT(JAWT.java:108)
        at jogamp.nativewindow.jawt.JAWTUtil.getJAWT(JAWTUtil.java:301)
        at jogamp.nativewindow.jawt.JAWTUtil.<clinit>(JAWTUtil.java:339)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Unknown Source)
        at com.jogamp.nativewindow.NativeWindowFactory$3.run(NativeWindowFactory.java:344)
        at com.jogamp.nativewindow.NativeWindowFactory$3.run(NativeWindowFactory.java:340)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.nativewindow.NativeWindowFactory.initSingleton(NativeWindowFactory.java:340)
        at com.jogamp.opengl.GLProfile.initProfilesForDefaultDevices(GLProfile.java:1721)
        at com.jogamp.opengl.GLProfile.access$000(GLProfile.java:80)
        at com.jogamp.opengl.GLProfile$1.run(GLProfile.java:230)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.opengl.GLProfile.initSingleton(GLProfile.java:216)
        at com.jogamp.opengl.GLProfile.isAvailable(GLProfile.java:300)
        at com.jogamp.opengl.GLProfile.isAvailable(GLProfile.java:315)
        at org.jzy3d.chart.Settings.detectProfile(Settings.java:33)
        at org.jzy3d.chart.Settings.<init>(Settings.java:17)
        at org.jzy3d.chart.Settings.getInstance(Settings.java:50)
        at org.jzy3d.chart.Chart.<init>(Chart.java:65)
        at org.jzy3d.chart.AWTChart.<init>(AWTChart.java:26)
        at org.jzy3d.chart.factories.AWTChartComponentFactory.newChart(AWTChartComponentFactory.java:81)

Please help ! :)
Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

gouessej
Administrator
You have to ensure that you use a 64-bit JVM with the 64-bit native libraries but JogAmp isn't responsible for your custom loader. If your loader "sees" the wrong native libraries and load them, it can't work, i.e the native libraries must match with the Java libraries.

I advise you to split your problem into 2 smaller ones. At first, use a version of Jzy3D modified to work with JOGL 2.3.2 without your custom loader (it works, Martin can confirm it). Then, fix your bug(s) in your own custom loader.

Reminder: If you really want to load the libraries by yourself, you must do it very early before JogAmp initialization and you might have to load some native dependencies (especially for AWT). It can become very tricky very fast. If I were you, I would rather tell us why you need a custom loader and maybe do a request for enhancement to get something that fits into your needs instead of reinventing the wheel in worse. For example, I'd like to get an automated native library loading without a cache, typically for environments in which you can't create a temporary directory except in the one you already use for your own software.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

Gaël
I followed your advise so I commented the call to my class and I add all natives jar as dependencies to my plugin. They re in my bundle_pool folder, same level as jogl and gluegen jar.

Here s the error :
java.lang.UnsatisfiedLinkError: Can't load library: C:\FPP\eclipse\natives\windows-amd64\\gluegen-rt.dll
        at java.lang.ClassLoader.loadLibrary(Unknown Source)
        at java.lang.Runtime.load0(Unknown Source)
        at java.lang.System.load(Unknown Source)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibraryInternal(JNILibLoaderBase.java:624)
        at com.jogamp.common.jvm.JNILibLoaderBase.access$000(JNILibLoaderBase.java:63)
        at com.jogamp.common.jvm.JNILibLoaderBase$DefaultAction.loadLibrary(JNILibLoaderBase.java:106)
        at com.jogamp.common.jvm.JNILibLoaderBase.loadLibrary(JNILibLoaderBase.java:487)
        at com.jogamp.common.os.DynamicLibraryBundle$GlueJNILibLoader.loadLibrary(DynamicLibraryBundle.java:421)
        at com.jogamp.common.os.Platform$1.run(Platform.java:317)
        at java.security.AccessController.doPrivileged(Native Method)
        at com.jogamp.common.os.Platform.<clinit>(Platform.java:287)

I don't even know from where it finds this path. (FYI "C:\FPP\eclipse" is my eclipse installation folder and there isn't a "natives" folder)

I'm actually running on a 64-bit JVM.
About the custom loader, may be I used a wrong term. I mean, because I develop an eclipse plugin, jogl can t find the requested nat libs (I don't know why but the automated loading doesn't work) so I have to copy them from my plugin to a tmp folder and set the path to this tmp folder in java.library.path
This happend at the very begining of my plugin life-cycle

That is what my class do. Thereafter I let jogamp loads nat libraries whenever it wants.
About the nat libs themselves, I put them (good os, arch and jogl version) in my bundle so I'm sure my class exposes good ones.

In addition i noticed that, when i use my class for expose nat libs as I said I have the UnsatisfiedLinkError: jogamp.nativewindow.jawt.JAWTFactory.JAWT_GetAWT1(Ljava/nio/ByteBuffer;)Z, but when i searching for nat libs that were loaded i could see that gluegen-rt and nativewindow_awt were succefully loaded PLUS awt.dll and jawt.dll

Is this normal ?

Odd things too, when i recall the jogamp part, so gluegen-rt and nativewindow_awt are load, I have an other error :
com.jogamp.opengl.GLException: No default device available
        at com.jogamp.opengl.GLProfile.getProfileMap(GLProfile.java:2300)
        at com.jogamp.opengl.GLProfile.isAvailable(GLProfile.java:301)
        at com.jogamp.opengl.GLProfile.isAvailable(GLProfile.java:315)
        at org.jzy3d.chart.Settings.detectProfile(Settings.java:33)
        at org.jzy3d.chart.Settings.<init>(Settings.java:17)



Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

gouessej
Administrator
gluegen != gluegen-rt

You have to disable the automated native library loading when setting the Java library path. Yes AWT native libraries have to be loaded.

Do you use OSGI?

Why not trying to put jogamp-fat.jar into your classpath as a first step to get something working?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

gouessej
Administrator
In reply to this post by Gaël
I think that JogAmp fails to extract the native libraries and looks for the directories in the PATH environment variable including "C:\FPP\eclipse".

Do you succeed in running a very simple example without Eclipse?

Wade Walker wrote some tutorials about Eclipse RCP and JOGL, you should read them:
http://wadeawalker.wordpress.com/2010/10/24/tutorial-creating-native-binary-executables-for-multi-platform-java-apps-with-opengl-and-eclipse-rcp/
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: UnsatisfiedLinkError: jogamp.nativewindow.jawt

Wade Walker
Administrator
In reply to this post by Gaël
Hi Gaël,

You might look at this post (http://forum.jogamp.org/JOGL-with-OSGi-td3773888.html) where I talk about how Eclipse applications find the JOGL JARs that contain these native libraries. You might need to add a custom path resolver to the Eclipse app, otherwise it won't find the JOGL JARs correctly (see the other post for more details).