United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6571600 : JNI use results in UnsatisfiedLinkError looking for libmawt.so

Details
Type:
Bug
Submit Date:
2007-06-20
Status:
Resolved
Updated Date:
2014-06-05
Project Name:
JDK
Resolved Date:
2013-12-23
Component:
client-libs
OS:
other,linux
Sub-Component:
java.awt
CPU:
x86,generic
Priority:
P3
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:
Backport:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Server VM (build 1.6.0-b105, mixed mode)

and

java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Linux 2.6.9-42.0.3.EL #1 Fri Oct 6 05:59:54 CDT 2006 i686 i686 i386 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
When running inside a custom JNI library creating an instance of any awt class fails with an UnsatisfiedLinkError for libmawt.so.

The error was first seen with 1.6, but don't know if present in 1.5. Code which runs under 1.4.2 but will not run under 1.6.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile a C++ program which starts JNI. Inside the Java application, create a separate thread to instantiate awt classes, and then return. The first instantiation of any awt class fails with UnsatisfiedLinkError for libmawt.so.

Build the source by typing "./build.bash" on the Linux command line. The
example may be executed by typing "./run_oasis.bash". The "./clean.bash"
command cleans up the directory.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The application's Swing-based windows would be displayed on the screen. In the testcase a blank window should be displayed on the screen
ACTUAL -
Custom JNI library is found, but dependent library libmawt.so is not.
The following is output:
csh-3.00$ ./run_oasis.bash
callback from JNI
JavaJNIInt: initCPP() succeeded
JVM started in CPPJNIInt::init
Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: Can't
load library: /home/alink/sunbug/xawt/libmawt.so
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1650)
        at java.lang.Runtime.load0(Runtime.java:770)
        at java.lang.System.load(System.java:1005)
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1030)
        at
sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
        at java.security.AccessController.doPrivileged(Native Method)
        at
sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
        at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
        at java.awt.Component.<clinit>(Component.java:552)
        at JavaJNIInt.run(JavaJNIInt.java:41)
        at java.lang.Thread.run(Thread.java:619)


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "Thread-0" java.lang.UnsatisfiedLinkError: Can't load library: /home/alink/alink_work3/Source/SimDesEng/exe/xawt/libmawt.so
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1650)
        at java.lang.Runtime.load0(Runtime.java:770)
        at java.lang.System.load(System.java:1005)
        at java.lang.ClassLoader$NativeLibrary.load(Native Method)
        at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1751)
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1030)
        at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.loadLibraries(Toolkit.java:1594)
        at java.awt.Toolkit.<clinit>(Toolkit.java:1616)
        at java.awt.Color.<clinit>(Color.java:263)
        at MapBuilder.<init>(MapBuilder.java:71)
        at MapGraphics.<clinit>(MapGraphics.java:26)
        at cDataInterface.<clinit>(cDataInterface.java:245)
        at JavaJNIInt.run(JavaJNIInt.java:352)
        at java.lang.Thread.run(Thread.java:619)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Attached seperatly
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
No work around at this time, other than regressing to Java 1.4.2

Attempted work-arounds suggested by similar problem reported in Bug 6539705 with no improvement in behaviour.

                                    

Comments
URL:   http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/35dfaa9954c2
User:  lana
Date:  2014-03-25 20:49:04 +0000

                                     
2014-03-25
Justification: Per earlier discussions - re-targeting to 7u55
                                     
2014-01-06
Linux test case
                                     
2013-12-26
Solaris test case
                                     
2013-12-26
URL:   http://hg.openjdk.java.net/jdk9/client/jdk/rev/35dfaa9954c2
User:  dbuck
Date:  2013-12-23 20:08:06 +0000

                                     
2013-12-23



Hardware and Software, Engineered to Work Together