vesontio
vesontio

Reputation: 381

VMWare SDK Java samples cannot connect to vCenter

I've a Windows 2008 virtual machine whose IP address is 192.168.3.150, on which I have installed the vCenter Server. As I am not expert on vSphere, I have just done a Simple Install. Then on my laptop whose IP is 192.168.2.36, I can open the Web Client in my browser.

Both machines can ping each other, so I think the network connection is OK.

However when I tried to run the Java samples of SDK package, they can't connect to the vCenter.

run.bat com.vmware.general.SimpleClient --url https://192.168.3.150/sdk --username [email protected] --password blablabla --ignorecert ignorecert

I got an error message:

WARNING: Java is now set to trust all SSL certificates. -- VMware samples in Java -- The server at https://192.168.3.150:7444/ims/STSService did not respond as expec ted. Is this a valid URL?Note: SSO connections only work on vCenter SSO enabled products. Use the --basic-connection switch if you know this is an ESX host. See the connection.properties file for more instructions. No valid connection available. Exiting now. Done.

I have tried to run the samples in the virtual machine, same problem.

Any idea please ?

Upvotes: 0

Views: 4591

Answers (2)

Rishi Anand
Rishi Anand

Reputation: 300

This solution works perfectly fine for VI java SDK. Pass 'true' in new ServiceInstance as last parameter to ignoreCert.

        URL serviceUrl = new URL("https://192.168.3.150/sdk");
        return new ServiceInstance(serviceUrl, "[email protected]","blablabla", true);

Upvotes: 1

vesontio
vesontio

Reputation: 381

Well, I've solved the program by following the tutorial Getting Started With the vSphere Management SDK. I can finally connect to my vCenter by using its code. It turns out to be a certificate verification issue. I don't know why the option --ignorecert of the SDK samples doesn't work.

Upvotes: 0

Related Questions