Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem accessing some shared library in Linux

843829Feb 16 2004 — edited Jan 4 2005
I a trying to write a JNI interface to one of the standard libraries in Linux (and many other flavours of Unix). THe library is PAM and as a first hash I want to make sure I can call into the library correctly (the final aim is to create a JAAS LoginModule). Anyway I have the C code written and two ways of running it. One is in C and takes arguments from the command line, passes them to my C functions and that works fine. The other is the JNI interface. I have the java class written and it calls the JNI code which in turn calls my C functions. My problem is that when called from java, something doesn't work right. Although PAM gets called, it throws errors out onto the syslog:

PAM [dlerror: /lib/security/pam_env.so: undefined symbol: pam_get_item]
PAM adding faulty module: /lib/security/pam_env.so
PAM unable to dlopen(/lib/security/pam_unix.so)
PAM [dlerror: /lib/security/pam_unix.so: undefined symbol: pam_get_item]
PAM adding faulty module: /lib/security/pam_unix.so

It seems that PAM cannot load the shared libraries that it uses when it has been called from java.

I compile with the following command:

cc -Wall -fPIC -lpam -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -shared auth.o **.c -o libosapi.so

I cannot test thsi on a windows platform since windows has no equivalent to PAM and I have no access to any other variant of unix/linux

Can anbody make any suggestions as to how to proceed?

Dave
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 1 2005
Added on Feb 16 2004
5 comments
375 views