[one-users] Err in opennebula java example program "Trying to allocate the virtual machine... failed! [VirtualMachineAllocate] User couldn't be authenticated, aborting call. "

Hector hector at convivencial.org
Tue Oct 16 12:44:10 PDT 2012


I'm not familiar with java, but for the authentication problem try calling  
new Client with a user:password tuple:

Client(java.lang.String secret, java.lang.String endpoint)

http://opennebula.org/doc/3.6/oca/java/org/opennebula/client/Client.html#Client(java.lang.String,  
java.lang.String)

Hector


En Tue, 16 Oct 2012 20:20:33 +0200, rajesh kannan  
<asrajeshkannan at gmail.com> escribió:

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


-- 
Hector
@hecsanjuan



More information about the Users mailing list