Print all the VM's in XenServer using Java API

287 views Asked by At

I have been trying to play around with Xenserver by printing the VM's present by using the following code

Connection conn = new Connection(new URL("http://"));
Session.loginWithPassword(conn, "xyz", "xyz", "");
Object type //parameter)
**"int size = VM.getAll(conn).size();//how many objects in XCP"**
Object objArr[] = VM.getAll( conn ).toArray();//Trandfer <Set>VM to Object array
VM a = Types.toVM( objArr[0] );
System.out.println( a.getUuid( conn ) );

But failed to get the desired result as it throws an exception for the quoted line. Can someone tell me where the hell am I going wrong?

0

There are 0 answers