java.lang.UnsatisfiedLinkError
 Technote (FAQ)
 
Problem
Selecting the Websphere® datasource test connection button results in a java.lang.UnsatisfiedLinkError
 
Cause
This exception typically results when using a type 2 JDBC driver and one or more of the following conditions occur.
  • Cannot locate the driver's required native libraries
  • The loaded version of the native libraries do not match the version of the driver
  • Websphere Application Server's Java™ Virtual Machine (JVM) cannot load the drivers native libraries
 
Solution
The DB2® type 2 JDBC Driver will be used as an example, though the following can apply to other type 2 JDBC drivers as well.

Cannot locate the required driver's native libraries

  • For the UNIX® user that is responsible for starting the Websphere Application Server (example: root), edit the user's .profile and add a line to source the db2profile.sh script to set up the required environment variables for DB2 (i.e. DB2INSTANCE, CLASSPATH, LD_LIBRARY_PATH, etc). For example:

    . /home/db2inst1/sqllib/db2profile



You can verify db2profile has been successfully sourced by stopping the Websphere Application Server and adding the "env" command to the bottom of <Websphere InstallRoot>/bin/startServer.sh script file to print out the settings of all the environment variables used by the Websphere Application Server's JVM and redirect the output to a file, for example:
env > env.out

From the resulting env.out, verify the required environment variables used by the JDBC Driver are listed and have the correct settings, for example:


CLASSPATH=/home/db2inst1/sqllib/java12/db2java.zip

DB2INSTANCE=db2inst1

LIBPATH=/home/db2inst1/sqllib/lib


Notes:

The library path environment variable is LD_LIBRARY_PATH for Linux® & SUN , LIBPATH for AIX® and SHLIB_PATH for HP-UX.

db2inst1 is the name of the DB2 instance in this example. Your DB2 instance may have a different name.

/home/db2inst1/ is the directory where DB2 is installed. Your DB2 installation path may be different.

  • From your Websphere Administrative Console,

    Resources > JDBC Provider > <Your JDBC Provider>
    In the Configuration panel, under the General Properties section, specify the directory where the driver's native libraries are located in the Native Library Path field, for example:

    /home/db2inst1/sqllib/lib

The loaded version of the native libraries that do not match the version of the driver

  • The JDBC driver level does match the native libraries used.
  • Multiple copies of db2java.zip are on the JVM's system classpath. Even though the Websphere configuration points to a specific driver, since the driver consist of multiple classes, the classloader can cause classes in the wrong driver's jar/zip to be invoked, which do not match the native libraries used.

Websphere Application Server's Java Virtual Machine (JVM) cannot load the native libraries

  • Websphere Application Server cannot load 64-bit libraries. Interrogate your DB2 version by issuing the command "db2level". This should produce an output similar to the following:

    DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL08020" with level identifier "03010106". Informational tokens are "DB2 v8.1.7.445", "s040812", "WR21342", and FixPak "7".
 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > DB Connections/Connection Pooling
Operating system(s): HP-UX
Software version: 4.0
Software edition:
Reference #: 1223798
IBM Group: Software Group
Modified date: Nov 29, 2005