<div>I given that opennebula example code below</div><div><br></div><div> that example code get complie but it will make a problem while executing the code </div><div><br></div><div>When i try to execute <i><u>first time</u></i> it shows like this </div>
<div><br></div><div><div><b>oneadmin@SONY-VAIO:~/lib/java$ java vmcre</b></div><div><br></div><div>Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlrpc/XmlRpcException</div><div> at vmcre.main(vmcre.java:14)</div>
<div>Caused by: java.lang.ClassNotFoundException: org.apache.xmlrpc.XmlRpcException</div><div> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)</div><div> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)</div>
<div> at java.security.AccessController.doPrivileged(Native Method)</div><div> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)</div><div> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)</div>
<div> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)</div><div> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)</div><div> ... 1 more</div><div><br></div><div><i><u>SECOND time</u></i></div>
<div><b>oneadmin@SONY-VAIO:~/lib/java$ java vmcre</b></div></div><div><br></div><div><br></div><div>After that problem or err was""<b><font class="Apple-style-span" color="#ff0000">Trying to allocate the virtual machine... failed! [VirtualMachineAllocate] User couldn't be authenticated, aborting call. </font></b> """</div>
<div><br></div><div><div>Here i show the my java code</div></div><div><br></div><div>i dont know how to reslove this pls guide me to slove this problem </div><div><br></div><div><b><i>PROGRAM</i></b></div><div>import java.lang.*;</div>
<div>import java.io.*; </div><div>import org.opennebula.client.Client;</div><div>import org.opennebula.client.vm.VirtualMachine;</div><div>import org.opennebula.client.OneResponse;</div><div>import org.apache.xmlrpc.XmlRpcException;</div>
<div><br></div><div>public class vmcre </div><div>{</div><div>public static void main(String args[])</div><div>{</div><div>try</div><div>{</div><div> Client oneClient = new Client();</div><div><br></div><div>// I dont know whether i have to change this source path or not even i dont do any changes on this but it will not work</div>
<div><br></div><div> </div><div> String vmTemplate =</div><div> "NAME = vm_from_java CPU = 0.1 MEMORY = 64\n"</div><div> + "DISK = [\n"</div><div> + "\tsource = \"/home/user/vmachines/ttylinux/ttylinux.img\",\n"</div>
<div> + "\ttarget = \"hda\",\n"</div><div> + "\treadonly = \"no\" ]\n"</div><div> + "FEATURES = [ acpi=\"no\" ]";</div><div> </div><div> System.out.print("Trying to allocate the virtual machine... ");</div>
<div> OneResponse rc = VirtualMachine.allocate(oneClient, vmTemplate);</div><div> </div><div> if( rc.isError() )</div><div> {</div><div> System.out.println( "failed!");</div><div> throw new Exception( rc.getErrorMessage() );</div>
<div> }</div><div> int newVMID = Integer.parseInt(rc.getMessage());</div><div> System.out.println("ok, ID " + newVMID + ".");</div><div> </div><div> VirtualMachine vm = new VirtualMachine(newVMID, oneClient);</div>
<div> </div><div> System.out.print("Trying to hold the new VM... ");</div><div> rc = vm.hold();</div><div> </div><div> if(rc.isError())</div><div> {</div><div> System.out.println("failed!");</div>
<div> throw new Exception( rc.getErrorMessage() );</div><div> }</div><div> </div><div> rc = <a href="http://vm.info">vm.info</a>();</div><div> </div><div> if(rc.isError())</div><div> throw new Exception( rc.getErrorMessage() );</div>
<div> </div><div> System.out.println();</div><div> System.out.println(</div><div> "This is the information OpenNebula stores for the new VM:");</div><div> System.out.println(rc.getMessage() + "\n");</div>
<div> </div><div> System.out.println("The new VM " +</div><div> vm.getName() + " has status: " + vm.status());</div><div> </div><div> System.out.println("The path of the disk is");</div>
<div> System.out.println( "\t" + vm.xpath("template/disk/source") );</div><div> </div><div> rc = vm.finalizeVM();</div><div> System.out.println("\nTrying to finalize (delete) the VM " +</div>
<div> vm.getId() + "...");</div><div> </div><div>}</div><div>catch (Exception e)</div><div>{</div><div> System.out.println(e.getMessage());</div><div>}</div><div>}</div><div>}</div><div>
<br></div><div><br></div><div>pls guide me to do this>>>>>>>>>></div>