[libvirt] Connection using Java

Hi, I am using java to connect to the xen, but my class is throwing a exception. Does anyone know what is happening? public class TestConnection { public static void main(String[] args) { Connect conn = null; try { conn = new Connect("xen+ssh://root@192.XXX.XXX.XX/", true); libvir: RPC error : End of file while reading data: nc: invalid option -- 'U' nc -h for help: Input/output error exception caught:org.libvirt.LibvirtException: End of file while reading data: nc: invalid option -- 'U' nc -h for help: Input/output error level:VIR_ERR_ERROR code:VIR_ERR_SYSTEM_ERROR domain:VIR_FROM_RPC hasConn:false hasDom:false hasNet:false message:End of file while reading data: nc: invalid option -- 'U' nc -h for help: Input/output error str1:%s str2:End of file while reading data: nc: invalid option -- 'U' nc -h for help: Input/output error str3:null int1:-1 int2:-1 Thanks, Felipe -- *-- Felipe Oliveira Gutierrez* *-- **lipe.82@gmail.com* <lipe.82@gmail.com> *-- https://sites.google.com/site/lipe82/Home/diaadia*

On 10/02/2012 09:10 AM, Felipe Oliveira Gutierrez wrote:
Hi,
I am using java to connect to the xen, but my class is throwing a exception. Does anyone know what is happening?
public class TestConnection { public static void main(String[] args) { Connect conn = null; try { conn = new Connect("xen+ssh://root@192.XXX.XXX.XX/", true);
libvir: RPC error : End of file while reading data: nc: invalid option -- 'U'
What distro is running the machine at 192.XXX.XXX.XX, and what version of nc is it using (remembering that Fedora and Debian nc come from different heritages)? What does 'nc --help' output on that machine? It may be possible to connect by installing an updated nc on that machine, and/or altering your xen+ssh://... URI to include a ?netcat=... parameter that points to an alternate location on that server that understands -U. http://libvirt.org/remote.html#Remote_URI_parameters -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Hi Eric, thanks for reply My netcat version is v1.10-38 and I am using Debian on 192.XXX.XXX.XX # nc -h [v1.10-38] connect to somewhere: nc [-options] hostname port[s] [ports] ... listen for inbound: nc -l -p port [-options] [hostname] [port] I use Ubuntu to access the Debian machine, and now my Java class is like this: public static void main(String[] args) { Connect conn = null; try { conn = new Connect("xen+ssh://root@192.168.XXX.XX/?netcat=/bin/netcat", true); but is still throwing the error: libvir: RPC error : End of file while reading data: /bin/netcat: invalid option -- 'U' nc -h for help: Input/output error exception caught:org.libvirt.LibvirtException: End of file while reading data: /bin/netcat: invalid option -- 'U' I have files on the client machine that are /usr/bin/ncat , /bin/netcat and /etc/alternatives/netcat. I am not sure which I should use. Thanks, Felipe On Tue, Oct 2, 2012 at 12:27 PM, Eric Blake <eblake@redhat.com> wrote:
On 10/02/2012 09:10 AM, Felipe Oliveira Gutierrez wrote:
Hi,
I am using java to connect to the xen, but my class is throwing a exception. Does anyone know what is happening?
public class TestConnection { public static void main(String[] args) { Connect conn = null; try { conn = new Connect("xen+ssh://root@192.XXX.XXX.XX/", true);
libvir: RPC error : End of file while reading data: nc: invalid option -- 'U'
What distro is running the machine at 192.XXX.XXX.XX, and what version of nc is it using (remembering that Fedora and Debian nc come from different heritages)? What does 'nc --help' output on that machine?
It may be possible to connect by installing an updated nc on that machine, and/or altering your xen+ssh://... URI to include a ?netcat=... parameter that points to an alternate location on that server that understands -U.
http://libvirt.org/remote.html#Remote_URI_parameters
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
-- *-- Felipe Oliveira Gutierrez* *-- **lipe.82@gmail.com* <lipe.82@gmail.com> *-- https://sites.google.com/site/lipe82/Home/diaadia*

Hi. At Tue, 2 Oct 2012 12:57:03 -0300, Felipe Oliveira Gutierrez wrote:
My netcat version is v1.10-38 and I am using Debian on 192.XXX.XXX.XX
# nc -h [v1.10-38] connect to somewhere: nc [-options] hostname port[s] [ports] ... listen for inbound: nc -l -p port [-options] [hostname] [port]
I use Ubuntu to access the Debian machine, and now my Java class is like this:
public static void main(String[] args) { Connect conn = null; try { conn = new Connect("xen+ssh://root@192.168.XXX.XX/?netcat=/bin/netcat", true);
but is still throwing the error: libvir: RPC error : End of file while reading data: /bin/netcat: invalid option -- 'U' nc -h for help: Input/output error exception caught:org.libvirt.LibvirtException: End of file while reading data: /bin/netcat: invalid option -- 'U'
I have files on the client machine that are /usr/bin/ncat , /bin/netcat and /etc/alternatives/netcat. I am not sure which I should use.
These are actually all the same. Run "update-alternatives --display nc" to show the current config and list alternative choices. Installing the OpenBSD nc ("sudo apt-get install netcat-openbsd") on your Debian machine should solve this. Just use nc.openbsd in your connection string to make sure it is used. -- AV-Test GmbH, Henricistraße 20, 04155 Leipzig, Germany Phone: +49 341 265 310 19 Web:<http://www.av-test.org> Eingetragen am / Registered at: Amtsgericht Stendal (HRB 114076) Geschaeftsfuehrer (CEO): Andreas Marx, Guido Habicht, Maik Morgenstern
participants (3)
-
Claudio Bley
-
Eric Blake
-
Felipe Oliveira Gutierrez