Problem loading JNI library

K

Kiran

Hi,

I'm trying to load JNI based library from C application. Library loads
fine, but when I try to access functions, it gives following error...

"There was an error trying to initialize the HPI library.
Please check your installation, HotSpot does not work correctly
when installed in the JDK 1.2 Solaris Production Release, or
with any JDK 1.1.x release."

With second try, it gives following error and quits the app!

"Error occurred during initialization of VM
Signal chaining not allowed for VM interrupt signal, try
-Xusealtsigs."


I'm using JDK 1.4, which is copy of the JDK files. On this system JDK
1.2.2 is installed under /usr/java1.2. JAVA_HOME points to 1.4 and
PATH contains 1.4 bin folders, still not sure why it tries to load 1.2
hotspot...

Any idea what could be goingon here?

Thanks,
Kiran
 
G

Gordon Beaton

I'm trying to load JNI based library from C application. Library loads
fine, but when I try to access functions, it gives following error...

"There was an error trying to initialize the HPI library.
[...]

I'm using JDK 1.4, which is copy of the JDK files. On this system JDK
1.2.2 is installed under /usr/java1.2. JAVA_HOME points to 1.4 and
PATH contains 1.4 bin folders, still not sure why it tries to load 1.2
hotspot...

Any idea what could be goingon here?

Are you using Solaris? The error message seems to indicate that, but
isn't entirely clear.

Use ldd to see what libraries your executable depends on (and exactly
which ones are found). Also check the linker flags you used to build
it, as well as your LD_LIBRARY_PATH setting.

Have a look at the Solaris linking and libraries guide to see how to
control this behaviour. It's part of the software developer collection
for your specific OS version, find it at http://docs.sun.com/ .

/gordon
 
K

kiran.dpatil

FYI... Problem is on Solaris 5.7

truss output shows it fails to load library libhpi.so...

stat("/netapp/Components/dev/java/sunos-5.9-sparc/j2sdk1.4.2_03/jre/lib/native_threads/libhpi.so",
0xFFBEC36C) Err#2 ENOENT

Any idea why its missing from JDK 1.4?
 
K

kiran.dpatil

Something is wrong here....

JDK 1.4 for Sun 5.7 is at
"/netapp/Components/dev/java/SunOS.5.7/j2sdk1.4.2_03", now sure how
come its trying to fetch libhpi.so from
"/netapp/Components/dev/java/sunos-5.9-sparc/j2sdk1.4.2_03".

Any clue?
 
K

kiran.dpatil

Real problem is its(internal libjvm.so dependency) trying to load
"./jre/lib/native_threads/libhpi.so" where as libhpi.so is available at
"./jre/lib/sparc/native_threads/libhpi.so".

Now the question is why is libjvm.so is trying to load libhpi.so from
wrong location? any possible workaround?
 
G

Gordon Beaton

Real problem is its(internal libjvm.so dependency) trying to load
"./jre/lib/native_threads/libhpi.so" where as libhpi.so is available at
"./jre/lib/sparc/native_threads/libhpi.so".

Now the question is why is libjvm.so is trying to load libhpi.so from
wrong location? any possible workaround?

<repeating myself>

The linking and libraries guide gives lots of information about how to
influence the runtime linker.

Compile-time linker flags is one way. LD_LIBRARY_PATH is another.

</repeating myself>

/gordon
 
K

kiran.dpatil

Thanks for tips Gordon :)

I didn't reliaze I can influence internal library loading with linker
flags or LD_LIBRARY_PATH. ./jre/lib/sparc is part of LD_LIBRARY_PATH
but that didn't help.

Explicit linking with libhpi.so resolved the that problem, but still
I'm not able to use JNI interface. Will post on another thread if
required.

-Kiran
 
K

kiran.dpatil

Resolution:
I was linking with "./jre/lib/sparc/libjvm.so", if I link with
"./jre/lib/sparc/client/libjvm.so" everything works fine. I don't need
libhpi.so either.
 
S

sid Blane via JavaKB.com

I'm using J2EE and fixed this error on my Redhat 9.0 system by using a
symbolic link to libjvm.so. ln -s
/opt/SUNWappserver/jdk/jre/lib/i386/server/libjvm.so . Copying the shared
object to the location you need it in does NOT work. It must be a link.
The shared object probabaly has some relative references to other libraries
in the directory tree.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

JNI Programming 19
JNI can't look up inner class 7
JNI and Web Services 3
JNI question 1
JNI Stack Problem 2
JNI problem on Linux 0
JNI problem on Solaris 9 3
JNI & C & EVENTS 2

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top