Hi everyone,

I'm a bit stuck getting a native library working in Karaf so I hope you guys
can help me:

Short Intro:
In my project I want to make use of lp_solve (a Mixed Integer Linear
Programming) for that I found some java libraries which make use of JNI to
access this library. This works just fine in a non-OSGi project, however, I
have some troubles to get it running within karaf.

The problem: 
First the JavaLibrary tries to load the .so (or dll file for windows) via
System.loadLibrary("xxx), if that fails it extracts the .so (for or dll for
windows) from a jar file and loads it via System.load(xxx). The second
approach works also in karaf (if I use the absolut path), but if the bundle
gets reloaded (or uninstalled and newly installed) I get an error message
such as: liblpsolve55j_x64.so already loaded in another classloader.
Which means I can only load it once

Other solution?:
I found a blog-post ([1]) and some users in this forum explaining how to
make use of native-libraries in osgi, however, for me System.loadLibrary
never found that library, maybe you know what I am doing wrong?

<pom.xml>
...
 <Bundle-NativeCode>
  xxx-library-so-64.so;osname=linux;processor=x86-64
 </Bundle-NativeCode>
...
</pom.xml>

any hints are appreciated and thank you in advance :)

best regards
Philipp

p.s. the bundle is self-contained, so I can upload it somewhere if wanted.

[1]http://holistictendencies.wordpress.com/2011/03/28/bundle-nativecode-using-platform-specific-dlls-from-osgi/



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Native-library-and-System-load-tp4032562.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Reply via email to