[prev in list] [next in list] [prev in thread] [next in thread]
List: hpux-devtools
Subject: RE: HPUX-DEVTOOLS: Problem loading shared library into java using jni on hpux 11.11
From: "Donsbach, Jeff" <jeff.donsbach () hp ! com>
Date: 2007-09-06 15:54:40
Message-ID: 0E766B4D32E1BC4A877197B95A04A25A01A4D85D () tayexc14 ! americas ! cpqcorp ! net
[Download RAW message or body]
(Catching up on old messages)
Jean-Paul is exactly correct as you found out. To avoid the same type of
error in the future, if/when you port to HP-UX on Itanium, make sure
that you name your library with a ".so" extension instead of ".sl" (.so
is the convention used on Itanium). Otherwise, you will end up with the
same type of error message.
Hope this helps avoid future pain,
Jeff D
--
Jeff Donsbach
Partner Technology Access Center - MA
HP Solution Alliances Engineering
-----Original Message-----
From: owner-hpux-devtools@cxx.cup.hp.com
[mailto:owner-hpux-devtools@cxx.cup.hp.com] On Behalf Of Duhra, Sarab
Singh
Sent: Friday, August 31, 2007 12:52 PM
To: Marinier, Jean-Paul; hpux-devtools@cxx.cup.hp.com
Cc: Tzschenscher, Jo
Subject: RE: HPUX-DEVTOOLS: Problem loading shared library into java
using jni on hpux 11.11
Thanks Jean-Paul. Your suggestion fixed the problem.
Regards
-Sarab
-----Original Message-----
From: Marinier, Jean-Paul
Sent: Friday, August 31, 2007 7:20 AM
To: hpux-devtools@cxx.cup.hp.com
Cc: Duhra, Sarab Singh; Tzschenscher, Jo
Subject: RE: HPUX-DEVTOOLS: Problem loading shared library into java
using jni on hpux 11.11
Hi,
>> System.loadLibrary("libperfdadv.sl");
a detail maybe overlooked: the official Java/Sun doc for
System.loadLibrary() mentions that the mapping between the Java level
library name and its system level name is "system-dependent".
On PA-RISC, it seems that a "lib" prefix gets magically added, and also
a ".sl" suffix. That is, the JVM actually tries to open library
"liblibperfdadv.sl.sl", and that fails of course.
You can check this by using "tusc" to trace the file access system calls
when your JVM runs.
Like this:
$ export SHLIB_PATH=.:/usr/lib
$ export JAVA_HOME=/opt/java1.5
$
$ uname -a
HP-UX ptac B.11.11 U 9000/800 1588720598 unlimited-user license $ $
$JAVA_HOME/bin/javac loadtest.java $ $ tusc -f -o tusc.log
$JAVA_HOME/bin/java loadtest
error: cannot load libperfdadv.sl
$
$ grep stat tusc.log | grep libperf
...
stat64("./liblibperfdadv.sl.sl", 0x7aff2870) ............. ERR#2 ENOENT
stat64("/usr/lib/liblibperfdadv.sl.sl", 0x7aff2870) ...... ERR#2 ENOENT
stat64("/usr/lib/liblibperfdadv.sl.sl", 0x7aff2870) ...... ERR#2 ENOENT
$ $ $ cat loadtest.java
class loadtest {
public native static void initialize();
public native static void sayHelloWorld();
public static void main(String args[])
{
try {
System.loadLibrary("libperfdadv.sl");
System.out.println("Successfull library load");
}
catch (UnsatisfiedLinkError Err) {
System.out.println("error: cannot load libperfdadv.sl");
return;
}
} // main()
} // class
$
So could you please retry with: System.loadLibrary("perfdadv");
Best regards,
Jean-Paul
-----Original Message-----
From: owner-hpux-devtools@cxx.cup.hp.com
[mailto:owner-hpux-devtools@cxx.cup.hp.com] On Behalf Of Duhra, Sarab
Singh
Sent: dijous, 30 / agost / 2007 21:09
To: hpux-devtools@cxx.cup.hp.com
Subject: HPUX-DEVTOOLS: Problem loading shared library into java using
jni on hpux 11.11
Hi,
I am using java1.5.0 on hpux 11.11.The java program loads a shared
library libperfdadv.sl using jni call -
System.loadLibrary("libperfdadv.sl"); Upon running the program
(SHLIB_PATH is set) , I get the following error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no
libperfdadv.sl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1707)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at
com.hp.ov.perfd.businesslogic.Adviser.<clinit>(Adviser.java:6)
Here are more details about the system and the environment.
Uname -a
HP-UX hpcb B.11.11 U 9000/800 1848859676 unlimited-user license
Java -version
>/opt/java/bin/java -version
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.5.0-_24_nov_2004_16_29) Java HotSpot(TM) Server VM (build 1.5.0 FCS
(JS B64) jinteg:11.24.04-15:51 PA2.0 (aCC_AP), mixed mode)
Chatr libperfdadv.sl
>chatr libperfdadv.sl
libperfdadv.sl:
shared library
shared library dynamic path search:
SHLIB_PATH enabled second
embedded path disabled first Not Defined
shared library list:
dynamic /home/ptc-nfs/chrisb/src/papi/libperfd.sl
shared vtable support disabled
explicit unloading enabled
static branch prediction disabled
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation disabled
text segment locking disabled
data segment locking disabled
third quadrant private data space disabled
fourth quadrant private data space disabled
third quadrant global data space disabled
data page size: D (default)
instruction page size: D (default)
nulptr references disabled
shared library private mapping disabled
Command line for the java commnad
#!/bin/sh
export JAVA_HOME=/opt/java
export
CLASSPATH=/crm/gp/source/perfdadv/debug:/home/ptc-nfs/chrisb/src/papi
export SHLIB_PATH=$CLASSPATH
echo "SHLIB_PATH is $SHLIB_PATH"
echo "Run the jni adviser ...."
$JAVA_HOME/bin/java -Djava.library.path=$CLASSPATH -classpath
$CLASSPATH com.hp.ov.perfd.businesslogic.Adviser
Here is the error on running the script:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no
libperfdadv.sl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1707)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:992)
at
com.hp.ov.perfd.businesslogic.Adviser.<clinit>(Adviser.java:6)
Regards
-Sarab
_________________________________________________________________
To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
with the message UNSUBSCRIBE hpux-devtools
_________________________________________________________________
_________________________________________________________________
To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
with the message UNSUBSCRIBE hpux-devtools
_________________________________________________________________
_________________________________________________________________
To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
with the message UNSUBSCRIBE hpux-devtools
_________________________________________________________________
_________________________________________________________________
To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
with the message UNSUBSCRIBE hpux-devtools
_________________________________________________________________
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic