Just wrote a tutorial:
Steve JIN, VMware Engineering
Creator of VMware Infrastructure Java API. VI Java API 2.0 --- 15 times faster than AXIS in loading, 4+ faster in deserialization; only 1/4 of the size required by AXIS. More importantly, the freedom to redistribute your applications. (Download, Samples, DocWiki, RSS Feed)
Get Connected with Other Developers in the Community?
You have to download jaxb-api.jar and jaxb-impl.jar. and change the line no 46 to
//import com.sun.xml.internal.bind.DatatypeConverterImpl;
import com.sun.xml.bind.DatatypeConverterImpl;//for jre1.5 support
Hope this helps you.
-Kem.
The key is you have to change the code. Thanks.
Hi Steve,
Please look at the below case, am not able to get MO for specified hosts through my VC URL.
ManagedEntity[] hosts = new InventoryNavigator(rootFolder).searchManagedEntities(
new String[][] { {"HostSystem", "esx1" }, {"HostSystem", "esx2" }}, true); //where esx1 and esx2 are my host names.
java.rmi.RemoteException: VI SDK invoke exception:java.io.IOException: Server returned HTTP response code: 500 for URL: https://198.168.100.167/sdk
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:169)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:118)
at com.vmware.vim25.ws.VimStub.retrieveProperties(VimStub.java:77)
at com.vmware.vim25.mo.PropertyCollector.retrieveProperties(PropertyCollector.java:78)
at com.vmware.vim25.mo.InventoryNavigator.retrieveObjectContents(InventoryNavigator.java:84)
at com.vmware.vim25.mo.InventoryNavigator.searchManagedEntities(InventoryNavigator.java:54)
But am able to get all MO by this way.
ManagedEntity[] hosts = new InventoryNavigator(rootFolder).searchManagedEntities("HostSystem");
Please advice. I need to get MO for hosts on Demand not for all existing hosts.Thanks.
-Kem
I am getting this same thing. I followed the steps and updated to latest Java. Any ideas?
Exception in thread "main" java.rmi.RemoteException: VI SDK invoke exception:java.net.ConnectException: Connection timed out: connect
at com.vmware.vim25.ws.WSClient.invoke(_WSClient.java:169_)
at com.vmware.vim25.ws.WSClient.invoke(_WSClient.java:118_)
at com.vmware.vim25.ws.VimStub.retrieveServiceContent(_VimStub.java:1177_)
at com.vmware.vim25.mo.ServiceInstance.<init>(_ServiceInstance.java:85_)
at com.vmware.vim25.mo.ServiceInstance.<init>(_ServiceInstance.java:69_)
at com.vmware.vim25.mo.samples.HelloVM.main(_HelloVM.java:22_)
Reguarding the previous Post, I am not running a VC just an ESX machine. I gave it the root credentials of that ESX machine. I am running ESX3.5u3.
Thanks for any help!! This will be really cool if I can get it to work.
Hey guys,
Figured out what I was doing wrong. Stupid mistake, fat fingered the IP address. Sorry for the bother works great!!
Steve,
Any clue on my previous post. Am not able to get MOs for multiple ESX hosts given through VC.
Please advice. Thanks.
-Kem
Hi Kem,
Sorry for being late to get back to you -- I was in EclipseCon these days.
I reposted your question and answered it on the project home on the sourceforge.net:
For all the folks,
Please post VI Java API related questions to the sourceforge forum in the future:
Thanks!
-Steve
Hi Steve,
One quick question.
In VI JAVA - How can we terminate the already opened user session through our API. This has been provided in VI SDK.
Ex -
TerminateUserSession t = new TerminateUserSession(up, username, password);// in VI SDK
t.doTheWork(); //will terminate the opened session.
Do we have like this in VI JAVA API?
Thanks.
-Kem
Steve,
Please ignore my previous post.
Am just trying to terminate the orphan user sessions which are in the server using VI JAVA API.
Please help me if you can. Thanks.
-Kem
Got it.
-Kem.
Steve cannot wait for your book - hopefully has some C# examples?
Ricky El-Qasem
VCI/VCP - MCSE - RHCT
Steve,
The jaxb jars are not distributable ( CDDL license ) , you cannot bundle it for commercial products.
can you please make it compatible for jre 1.5 or suggest changes
this is important for us to decide.
-Ganesh
Steve,
The jaxb jars are not distributable ( CDDL license ) , you cannot bundle it for commercial products.
can you please make it compatible for jre 1.5 or suggest changes
this is important for us to decide.
Steve,
The jaxb jars are not distributable ( CDDL license ) , you cannot bundle it for commercial products.
can you please make it compatible for jre 1.5 or suggest changes
this is important for us to decide.
-Ganesh
Hi steve,
I am very grateful for your work...i have used your programs for student project.
i have simple requirement for ignorecertificate to be false.
Please if there is a way could you tell how to do it
with this my project will be over.
Thank you..
Hi Steve,
In hello world program
ServiceInstance si = new ServiceInstance( new URL("https://servername/sdk"), "root", "password", true);
True parameter indicates that ignore certificate to be true.
i want ignore certificate to be false. so that i can give some certificate.
How to acheive this task.
Please suggest me is it possible to make the ignorecertificate parameter to false..
In such case how to acheive this..
Thanks in advance.
It's more than a short description, but the good thing is that it's not different from other Java programs using SSL certificate. At high level, you will need the server certificate into your keystore and include the keystore in the JVM parameter.
Check out the keytool command for more details.
Steve
i have some idea on keytool and i created the keystore.jks using the following command.
c:/java/jre/bin>keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass password -validity 360 -keysize 2048
it creates the keystore.jks in the bin folder.
i have to understand how to refer this keystore.jks in the java program.(i am having less knowledge on this...sorry)
what is meant when you said i need the server certificate into my keystore..
i just have to know how my program can make use of the keystore so that the certificate is identified by esxi server.
Thanks for your reply..