Operating System - HP-UX
1753506 Members
5393 Online
108794 Solutions
New Discussion юеВ

Re: System.loadLibrary() Unsatisfied Link Error loading 64bit JNI Shared lib

 
endobikr
New Member

System.loadLibrary() Unsatisfied Link Error loading 64bit JNI Shared lib

Cannot get a 64bit shared lib to load using Java6 System.loadLibrary().

I've broken this out into a simple testcase, and still cannot get this to load my library correctly.

public static void main(String argv[])throws Exception{
java.util.Properties props = System.getProperties();
System.out.println("Lib path = "+props.getProperty("java.library.path"));
try{
System.out.println("Call System.loadLibrary(" + argv[0] + ")");
System.loadLibrary(argv[0]);
}
catch (UnsatisfiedLinkError e){
System.out.println("EXCEPTION!");
System.out.println(" " + e.getCause());
System.out.println(" " + e.getMessage());
return;
}

Results:
/opt/java6/bin/java -d64 TcLoadLib samplelib64
Lib path = /opt/java6/jre/lib/IA64W:/opt/java6/jre/lib/IA64W/server:/opt/java6/jre/../lib/IA64W:/tmp/libpath:/tmp/libpath/:/usr/lib
Call System.loadLibrary(samplelib64)
EXCEPTION!
null
no samplelib in java.library.path

I've verified that the libsamplelib64.sl is in java.library.path (See output from cmd above) and is executable, and that it is a ELF-64 shared obj. (Also confirmed that the name is correct)
>file libsamplelib64.sl
libsamplelib64.sl: ELF-64 shared object file - IA64

As you can see I am testing with java6 in 64bit mode, and the java.library.path that is output during runtime is correct.

HP VERSION INFO : HP-UX B.11.31 U ia64 1169810284 unlimited-user license

I also was able to load this sharedlib outside of Java sucessfully (ldload), so I believe the library is built correctly.

Completely stumped, and I've begun looking for bugs/defects in HP or the JVM, but so far have not been able to isolate anything related here.

Any ideas?

4 REPLIES 4
Steven E. Protter
Exalted Contributor

Re: System.loadLibrary() Unsatisfied Link Error loading 64bit JNI Shared lib

Shalom,

What is the SHLIB_PATH set to when executing this program?

I would consider the possibility of updating Java from http://www.hp.com/go/java just for the sake of being current.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Dennis Handly
Acclaimed Contributor

Re: System.loadLibrary() Unsatisfied Link Error loading 64bit JNI Shared lib

>libsamplelib64.sl

On Integrity, shlib suffixes for java must be .so.
endobikr
New Member

Re: System.loadLibrary() Unsatisfied Link Error loading 64bit JNI Shared lib

Thanks for taking a look. Dennis, looks like that was it. I had looked at the extensions early on, but had seen that the HP-UX Linke and Libraries User's Guide said that

http://docs.hp.com/en/B2355-90968/linkerdifferencesiapa.htm
"For compatibility, the IPF linker also supports the .sl suffix. "

Retested with .so this morning and that appears to work.

Any ideas why the compatability mode may/may not work for *.sl naming convention??

Thanks again!
Dennis Handly
Acclaimed Contributor

Re: System.loadLibrary() Unsatisfied Link Error loading 64bit JNI Shared lib

>Any ideas why the compatibility mode may/may not work for *.sl naming convention?

Because you are looking at the linker documentation vs the java documentation. It too surprised me when my example program didn't work and I had to change my script. Perhaps it needs this to make sure that you can still run PA java on Integrity and keep the JNIs separate?

>Retested with .so this morning and that appears to work.

If you are happy with the answers you were given, please read the following on how to assign points:
http://forums.itrc.hp.com/service/forums/helptips.do?#33