Error Invalid magic number at calling native library at AIX

Hi,

I have a Java app calling functions from a C/C++ shared library. At Sun and HP all works fine, but the same stuff returns the following error when calling under AIX:

>java JIAK3smss

JIAK3sms.001I-Release 1.1.0 Start

Exception in thread "main" java.lang.UnsatisfiedLinkError: IAKJAVA (0509-026 System error: Cannot run a file that does not have a valid format.

0509-022 Cannot load module /u/iak/iak/lib/libIAKJAVA.a.

0509-103The module has an invalid magic number.)

at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:956)

at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:925)

at java.lang.System.loadLibrary(System.java:452)

at JIAK.JIAKroot.<init>(JIAKroot.java:50)

at JIAK.JIAKbaseClient.<init>(JIAKbaseClient.java:51)

at JIAK.JIAKsms.<init>(JIAKsms.java:37)

at JIAK3smss.main(JIAK3smss.java:30)

I have created the shared library at AIX with Visual Age as described in the manual.

Both the shared library and Java is 32 Bit. I've looked a lot around, but I can't solve the problem!

Does anybody knows something about this problem (it seems only at AIX)?

FlimmFlamm

Message was edited by:

FlimmFlamm

[1280 byte] By [FlimmFlamma] at [2007-11-26 19:58:08]
# 1
Hi folks,I've solved the problem at my own! To whom it磗 interesting, here is the solution:It seems, that Java on AIX can not deal with libraries ending with ".a" (even when they are dynamic libraries!).As I compiled my library with ending ".so", all worked fine!
FlimmFlamma at 2007-7-9 22:53:36 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
Perhaps it is not just the extension but also that you changed command line options (and that change resulted in the extension change)?
jschella at 2007-7-9 22:53:36 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3

You're right in that way, that I didn't only change the name of the extension. I just omited the last step: In the AIX manual where creating a shared library is described, you create an shared object, then use "ar" to create an archive library with extension ".a".

I just named the shared object "libXXX.so", and that worked!

FlimmFlamma at 2007-7-9 22:53:36 > top of Java-index,Java HotSpot Virtual Machine,Specifications...