[libvirt] RFC: libvirt java bindings based on JNA

Thomas Treutner thomas at scripty.at
Wed Jul 29 12:21:31 UTC 2009


On Wednesday 29 July 2009 13:49:45 Bryan Kearney wrote:
> Thomas Treutner wrote:
> > On Tuesday 28 July 2009 14:42:42 Bryan Kearney wrote:
> >> Thomas Treutner wrote:
> >>> When using it with my tiny test application (which works fine with the
> >>> JNI version), it first complains that /etc/pki/CA/cacert.pem can not be
> >>> found. As I installed libvirt from source, it's in /usr/local/...,
> >>> working fine with JNI. So I did a symlink workaround for now.
> >>
> >> Where did you see this complaint? 

Hm, I really cannot reproduce it anymore. Most probably it was caused by my 
libvirt-mixup.

> >> Also.. what is your LD_LIBRARY_PATH 
> >> set to when running this.

# cat /etc/ld.so.conf.d/*                                                    
/usr/local/lib
/usr/local/lib
/usr/lib/kde4/lib
# libc default configuration
/usr/local/lib
# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu


> >
> > The file not found was cacert.pem, not the *.so - so I don't think
> > LD_LIBRARY_PATH matters here?
> >
> > Anyways, the problem about
> >
> > 	conn = new Connect("xen://node02", false);
> >
> > was my fault - I forgot wiping an old apt-installed version of libvirt
> > before compiling libvirt-java-jna. It works now, but there seems to be a
> > massive typo somewhere; when I start my small application, it can't
> > find "liblibvirt.so" (sic!) and exits.
>
> Really.. can you send me the output?

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load 
library 'libvirt': liblibvirt.so: cannot open shared object file: No such 
file or directory
	at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:145)
	at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:188)
	at com.sun.jna.Library$Handler.<init>(Library.java:123)
	at com.sun.jna.Native.loadLibrary(Native.java:255)
	at com.sun.jna.Native.loadLibrary(Native.java:241)
	at org.libvirt.jna.Libvirt.<clinit>(Unknown Source)
	at org.libvirt.Connect.<clinit>(Unknown Source)
	at MyTest.main(MyTest.java:13)


MyTest.java:13:           conn = new Connect("xen://node01/", false);


> What version of jna do you have? 

# cat META-INF/MANIFEST.MF                                             
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.5.0_16-133 (Apple Inc.)
Main-Class: com.sun.jna.Native

Name: com/sun/jna/
Implementation-Title: com.sun.jna
Implementation-Vendor: JNA Development Team
Implementation-Version: 3.0.9 b0
Specification-Title: Java Native Access (JNA)
Specification-Vendor: JNA Development Team
Specification-Version: 3

It ist part of Eclipse, now downloaded 3.2.1 from jna.dev.java.net, with same 
results:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load 
library 'libvirt': liblibvirt.so: cannot open shared object file: No such 
file or directory
	at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:160)
	at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:228)
	at com.sun.jna.Library$Handler.<init>(Library.java:140)
	at com.sun.jna.Native.loadLibrary(Native.java:372)
	at com.sun.jna.Native.loadLibrary(Native.java:357)
	at org.libvirt.jna.Libvirt.<clinit>(Unknown Source)
	at org.libvirt.Connect.<clinit>(Unknown Source)
	at MyTest.main(MyTest.java:13)



hth&tia,
thomas







More information about the libvir-list mailing list