Hi Phillip,

did you try to just put the dll/so in lib folder of Karaf ?

Regards
JB

On 04/03/2014 03:02 PM, Philipp Hoenisch wrote:
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.


--
Jean-Baptiste Onofré
[email protected]
http://blog.nanthrax.net
Talend - http://www.talend.com

Reply via email to