Re: [one-users] Haven't authorized while using Java API

2012-11-28 Thread Hoàng Thái Xuân Khoa

On 11/27/2012 4:42 PM, Carlos Martín Sánchez wrote:

Can you check if you are using the same OpenNebula and Java OCA versions?
I'm using OpenNebula 3.6 and Java OCA 3.6 (i got a packet named: 
java-oca-3.6.0.tar.gz from 
http://dev.opennebula.org/projects/opennebula/files). I don't know why i 
got the error while using Java OCA, although i use command line and 
SunStone to manage private cloud successfully.


Thanks you Carlos.

Cheers.

--
Hoang Thai Xuan Khoa
Ho Chi Minh city, Vietnam

___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Haven't authorized while using Java API

2012-11-27 Thread Carlos Martín Sánchez
Can you check if you are using the same OpenNebula and Java OCA versions?
--
Carlos Martín, MSc
Project Engineer
OpenNebula - The Open-source Solution for Data Center Virtualization
www.OpenNebula.org | cmar...@opennebula.org |
@OpenNebulahttp://twitter.com/opennebulacmar...@opennebula.org



On Tue, Nov 27, 2012 at 3:37 AM, Hoàng Thái Xuân Khoa
htxuank...@gmail.comwrote:

  On 11/26/2012 4:47 PM, Giovanni Toraldo wrote:

 On Mon, Nov 26, 2012 at 10:43 AM, Hoàng Thái Xuân Khoahtxuank...@gmail.com 
 htxuank...@gmail.com wrote:

  Client client = new 
 Client(oneadmin:7f44b494160f2e69fed6c21b2ce555b8,http://localhost:2633/RPC2;
  http://localhost:2633/RPC2);

  This looks like an md5 hash, you should put your *real* password instead.

 --
 Giovanni Toraldohttp://gionn.net

  It's still didn't work.

 The 7f44b494160f2e69fed6c21b2ce555b8 is a default password when i
 installed OpenNebula. So, i don't know *real* password behind it. I decide
 use oneuser command to change oneadmin's password:
 oneadmin@cluster:~#oneuser passwd 0 123
 with 0 is the id of oneadmin user and 123 is a new password. After that, i
 can use password 123 to logon to SunStone server, managed private cloud via
 command line successfully. But, when i used it in Java code, it's didn't
 work.
 Client client = new 
 Client(oneadmin:123,http://localhost:2633/RPC2;http://localhost:2633/RPC2
 );
 I got the same error:

 *Error message: [HostPoolInfo] User couldn't be authenticated, aborting
 call.*

 --
 Hoang Thai Xuan Khoa
 Ho Chi Minh city, Vietnam


 ___
 Users mailing list
 Users@lists.opennebula.org
 http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Haven't authorized while using Java API

2012-11-26 Thread Hoàng Thái Xuân Khoa

On 11/25/2012 10:33 PM, Giovanni Toraldo wrote:

Hi Giovanni,

Thanks you so much for your reply.

if you instance Client without parameters, will be assumed to be at 
$ONE_AUTH, and the endpoint will be set to the environment variable 
$ONE_XMLRPC. 
I set the environment variable $ONE_AUTH and $ONE_XMLRPC when i managed 
private cloud. Here is the result in the command line:

/root@cluster:~# echo $ONE_AUTH//
///var/lib/one/.one/one_auth//
//root@cluster:~# echo $ONE_XMLRPC//
//http://localhost:2633/RPC2//
/
You may want to instance Client with: Client client = new 
Client(oneadmin:password,http://localhost:2633/RPC2;); 

I tried your solution but i got the same error:
/Client client = new Client(oneadmin:7f44b494160f2e69fed6c21b2ce555b8, 
http://localhost:2633/RPC2;);/
/Error message: [HostPoolInfo] User couldn't be authenticated, aborting 
call./


My password is correct because i used it to log on to SunStone Server 
successfully. When i entered http://localhost:2633/RPC2 address in the 
browser, it returned a message:

Error 405
POST is the only HTTP method this server understands

I don't know where i was wrong. Can you give me a hint to solve this 
problem?


Thanks you in advance.

--
Hoang Thai Xuan Khoa
Ho Chi Minh city, Vietnam

___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Haven't authorized while using Java API

2012-11-26 Thread Giovanni Toraldo
On Mon, Nov 26, 2012 at 10:43 AM, Hoàng Thái Xuân Khoa
htxuank...@gmail.com wrote:
 Client client = new Client(oneadmin:7f44b494160f2e69fed6c21b2ce555b8,
 http://localhost:2633/RPC2;);

This looks like an md5 hash, you should put your *real* password instead.

--
Giovanni Toraldo
http://gionn.net
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Haven't authorized while using Java API

2012-11-26 Thread Hoàng Thái Xuân Khoa

On 11/26/2012 4:47 PM, Giovanni Toraldo wrote:

On Mon, Nov 26, 2012 at 10:43 AM, Hoàng Thái Xuân Khoa
htxuank...@gmail.com wrote:

Client client = new Client(oneadmin:7f44b494160f2e69fed6c21b2ce555b8,
http://localhost:2633/RPC2;);

This looks like an md5 hash, you should put your *real* password instead.

--
Giovanni Toraldo
http://gionn.net

It's still didn't work.

The 7f44b494160f2e69fed6c21b2ce555b8 is a default password when i 
installed OpenNebula. So, i don't know *real* password behind it. I 
decide use oneuser command to change oneadmin's password:

oneadmin@cluster:~#oneuser passwd 0 123
with 0 is the id of oneadmin user and 123 is a new password. After that, 
i can use password 123 to logon to SunStone server, managed private 
cloud via command line successfully. But, when i used it in Java code, 
it's didn't work.

Client client = new Client(oneadmin:123,http://localhost:2633/RPC2;);
I got the same error:
/Error message: [HostPoolInfo] User couldn't be authenticated, aborting 
call./


--
Hoang Thai Xuan Khoa
Ho Chi Minh city, Vietnam

___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


[one-users] Haven't authorized while using Java API

2012-11-25 Thread Hoàng Thái Xuân Khoa

Hello everybody,

I have successfully managed private cloud using command line. And then i 
tried to write a simple program to test Java API. But when i use Java 
API, i haven't authorized. I don't know why because i have had one_auth 
file  i have successfully deployed virtual machine running in computer 
nodes by using command line. My Netbeans IDE runs under oneadmin user.


_Here is my program in Java:_
package exampleusingopennebulaapi;
import org.opennebula.client.Client;
import org.opennebula.client.OneResponse;
import org.opennebula.client.host.HostPool;

/**
 *
 * @author oneadmin
 */
public class ExampleUsingOpenNebulaAPI {
public static void main(String[] args) throws Exception {
Client client = new Client();
OneResponse or = HostPool.info(client);
if (or.isError()) {
System.out.println(Error message:  + or.getErrorMessage());
}
else{
System.out.println(No errors. This is xml content:  + 
or.getMessage());

}
}
}

And this is result i got:
Error message: [HostPoolInfo] User couldn't be authenticated, aborting call.

Can somebody help me? Thanks in advance.

--
Hoang Thai Xuan Khoa
Ho Chi Minh city, Vietnam

___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org


Re: [one-users] Haven't authorized while using Java API

2012-11-25 Thread Giovanni Toraldo
Hi,

On Sun, Nov 25, 2012 at 3:21 PM, Hoàng Thái Xuân Khoa
htxuank...@gmail.com wrote:
 Client client = new Client();

if you instance Client without parameters, will be assumed to be at
$ONE_AUTH, and the
endpoint will be set to the environment variable $ONE_XMLRPC.

You may want to instance Client with:
Client client = new Client(oneadmin:password,http://localhost:2633/RPC2;);

Cheers,
--
Giovanni Toraldo
http://gionn.net
___
Users mailing list
Users@lists.opennebula.org
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org