[libvirt-users] Java client error on Windows 7 64 bit for Libvirt on KVM

Matthias Bolte matthias.bolte at googlemail.com
Wed May 1 17:40:53 UTC 2013


2013/4/29 george john <simplyjoe13 at yahoo.com>:
> Hi,
> I need some help in building a Java client on Windows 7 64 bit plaftorm to manage a KVM using the libvirt APIs. Using the instructions at http://libvirt.org/java.html, i was able to build libvirt.jar. My understanding is that libvirt.jar uses JNA to call libvirt's native windows library. I tried using the libvirt dlls in the  experimental Windows installation package mentioned in http://libvirt.org/windows.html at http://libvirt.org/sources/win32_experimental/Libvirt-0.8.8-0.exe
> but whenever I try to connect to my remote API, I get the below Java exception :
> Exception in thread "main" java.lang.UnsatisfiedLinkError: %1 is not a valid Win32 application.
>
>         at com.sun.jna.Native.open(Native Method)
>         at com.sun.jna.Native.open(Native.java:1718)
>         at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:210)
>         at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:322)
>         at com.sun.jna.Library$Handler.<init>(Library.java:142)
>         at com.sun.jna.Native.loadLibrary(Native.java:387)
>         at com.sun.jna.Native.loadLibrary(Native.java:366)
>         at org.libvirt.jna.Libvirt.<clinit>(Unknown Source)
>         at org.libvirt.Library.<clinit>(Unknown Source)
>         at org.libvirt.Connect.<init>(Unknown Source)
>         at Main.main(Main.java:8)
>
> But when I try the same client code on a Windows XP 32 bit machine (with 32 bit JVM), I don't see this problem and the connection succeeds. So it looks like the problem is that I am not using 64 bit windows libvirt dlls. Is my assumption correct? Is there a Windows installer with 64 bit Libvirt dlls ? Or are the 64 bit version of DLLs published somewhere?

A 64bit process cannot use 32bit DLLs. You'll need libvirt and its
dependencies compiled for 64bit. I'm not aware of any pre-compiled
64bit libvirt DLLs.

> I tried using Matthias Bolte's msys_setup script (I tried in 2 machines) and in both machines, I get the below error when I try to run compile_libxml2.sh as per instructions https://github.com/photron/msys_setup/blob/master/readme_libvirt.txt
>
> Last few lines before the error is :
>
>>>>>>>>>>>>>>>>>>
> make[5]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python'
> make[4]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python'
> Making install in tests
> make[4]: Entering directory `/src/libxml2/libxml2-2.9.0-0/python/tests'
> make[5]: Entering directory `/src/libxml2/libxml2-2.9.0-0/python/tests'
> make[5]: Nothing to be done for `install-exec-am'.
> test -z "/share/doc/libxml2-python-2.9.0/examples" || /bin/mkdir -p "/share/doc/
> libxml2-python-2.9.0/examples"
>  /bin/install -c -m 644 build.py attribs.py tst.py tstxpath.py xpathext.py push.
> py pushSAX.py pushSAXhtml.py error.py serialize.py validate.py tstURI.py cutnpas
> te.py xpathret.py xpath.py outbuf.py inbuf.py resolver.py regexp.py reader.py re
> ader2.py reader3.py reader4.py reader5.py reader6.py reader7.py reader8.py reade
> rnext.py walker.py nsdel.py ctxterror.py readererr.py relaxng.py schema.py threa
> d2.py sync.py tstLastError.py indexes.py dtdvalid.py tstmem.py '/share/doc/libxm
> l2-python-2.9.0/examples'
>  /bin/install -c -m 644 validDTD.py validSchemas.py validRNG.py compareNodes.py
> xpathns.py xpathleak.py tst.xml valid.xml invalid.xml test.dtd '/share/doc/libxm
> l2-python-2.9.0/examples'
> make[5]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python/tests'
> make[4]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python/tests'
> make[3]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python'
> make[2]: Leaving directory `/src/libxml2/libxml2-2.9.0-0/python'
> make[1]: Leaving directory `/src/libxml2/libxml2-2.9.0-0'
> + cp /python/Lib/site-packages/libxml2mod.dll /python/DLLs/libxml2mod.pyd
> cp: cannot stat `/python/Lib/site-packages/libxml2mod.dll': No such file or dire
> ctory
>>>>>>>>>>>>>>>>>>>

I just fixed this problem, but this won't help you with your 64bit
problem. My msys_setup scripts compile libvirt for 32bit and it isn't
that easy to extend them for 64bit. This is mainly due to libvirt's
dependencies. For example, for gnutls the scripts just download
pre-compiled 32bit DLLs. It'll require some work to get libvirt and
its dependencies compiled for 64bit.

--
Matthias Bolte
http://photron.blogspot.com




More information about the libvirt-users mailing list