Released: vSphere Java API 2.1 Beta for vSphere 4.1

Following the vSphere 4.1 release, I am pleased to announce the release of the vSphere(VI) Java API 2.1 beta that fully supports the vSphere 4.1. The 2.1 beta has been ready for limited access for months by VMware internal teams, and partners/customers who participated vSphere 4.1 beta program.

The 2.1 beta works with VMware Infrastructure 3.0, 3.5, vSphere 4, and 4.1. It automatically detects the versions of 4 and 4.1, so you don’t need to change the way you work with the API. Besides the support of 4.1, it also includes several bug fixes since 2.0 update 1 released last December. For more info on what’s new in vSphere API 4.1, check out this blog.

Bothered by SLOW Web UI to manage vSphere? Want to manage ALL your VMware vCenters, AWS, Azure, Openstack, container behind a SINGLE pane of glass? Want to search, analyze, report, visualize VMs, hosts, networks, datastores, events as easily as Google the Web? Find out more about vSearch 3.0: the search engine for all your private and public clouds.

I plan to GA version 2.1 in about one month. Please help to give the beta a try. I need your help to report bugs for best quality of the API. You can download the API here, and file bugs here.

BTW, many thanks to those who have submitted the survey VMware does for this open source API. If you haven’t submitted yours yet, please do so quickly because the survey is closing soon. Your feedbacks are critical for the API to be supported.

This entry was posted in vSphere API and tagged . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.


  1. Posted August 10, 2010 at 7:44 am | Permalink

    Steve, will you plan deploy your great library to Maven repositories or create your own ????
    We’re using your library for year and now project is building by Maven, so we need to deploy your library into our repo manually.

  2. Posted August 11, 2010 at 9:40 pm | Permalink

    Thanks Nikita,

    I will look into it and let you know when it’s done.


  3. Samir Savla
    Posted August 13, 2010 at 8:22 pm | Permalink

    Hi Steve,

    We have this piece of code:
    String morStr = request.getParameter(MOREF);
    if (morStr == null) {
    return null;
    String type = morStr.substring(0, morStr.indexOf(“:”));
    String value = morStr.substring(morStr.indexOf(“:”) + 1);

    ManagedObjectReference mor = new ManagedObjectReference();
    LOG.debug(“Mor type: {0}”, type);
    LOG.debug(“Mor value: {0}”, value);
    String sessionStr = “vmware_soap_session=\””;
    if(request.getParameter(SESSION_ID) == null) {
    sessionStr = sessionStr+ request.getParameter(SERVER_GUID);
    } else {
    sessionStr = sessionStr + “\””;
    LOG.debug(“morStr:{0}”, morStr);
    String serviceUrl = request.getParameter(SERVICE_URL);
    LOG.debug(“serviceUrl: {0}”, serviceUrl);
    LOG.debug(“session: {0}”, sessionStr);
    LOG.debug(“tokenId: {0}”, request.getParameter(TOKEN_ID));

    ServiceInstance si = new ServiceInstance(new URL(serviceUrl), sessionStr, true);
    LOG.debug(“Service Instance values {0} — {1}”, si.toString(), si.getServerConnection());
    ManagedEntity me = MorUtil.createExactManagedEntity(si.getServerConnection(), mor);
    LOG.debug(“Managed Entity {0}”, me.toString());
    String name = me.getName();
    String morType = me.getMOR().getType();

    LOG.debug(“Selection name: {0}”, name);
    LOG.debug(“Mor type: {0}”, morType);

    This is to connect to a vcenter server. Apparently this works fine for 4.0 but i am getting me.getName() as null when i try to connect to 4.1 vcenter server. Any ideas what could be causing this? We’ve tried to look around but couldnt find anyone with similar issues.


  4. Posted August 13, 2010 at 9:29 pm | Permalink

    Hi Samir,

    What version of the vijava are you using? What is the value of your MOR? Can you use MOB to verify if the MOR exists?


  5. samir savla
    Posted August 14, 2010 at 12:14 am | Permalink

    Hi Steve,

    We’re using 4.0 version of vijava. When we checked the MOB we see the expected value for both the Host and the Datacenter objects. Mor type = Datacenter or HostSystem. I’m pasting the contents of the logger for your reference. As we can see the Selection Name which is the ManagedEntity name is null.


    2010-08-13 17:58:36,488 DEBUG [VMPluginServlet] Request URL = http://win-6e9ed5jke5b/vmplugin/
    2010-08-13 17:58:36,504 DEBUG [VMPluginServlet] Mor type: HostSystem
    2010-08-13 17:58:36,504 DEBUG [VMPluginServlet] Mor value: host-17
    2010-08-13 17:58:36,504 DEBUG [VMPluginServlet] morStr:HostSystem:host-17
    2010-08-13 17:58:36,504 DEBUG [VMPluginServlet] serviceUrl:
    2010-08-13 17:58:36,504 DEBUG [VMPluginServlet] session: vmware_soap_session=”F769B8B1-B4AB-4F3B-92C7-07B73B10C495″
    2010-08-13 17:58:36,504 DEBUG [VMPluginServlet] tokenId: d8d1a31b-8eaf-4157-a8b1-5c2cf1fd10b3
    2010-08-13 17:58:36,613 DEBUG [VMPluginServlet] Service Instance values ServiceInstance:ServiceInstance @ —
    2010-08-13 17:58:36,628 DEBUG [VMPluginServlet] Managed Entity HostSystem:host-17 @
    2010-08-13 17:58:36,644 DEBUG [VMPluginServlet] Selection name: null
    2010-08-13 17:58:36,644 DEBUG [VMPluginServlet] Mor type: HostSystem

  6. Posted August 14, 2010 at 12:37 am | Permalink


    What you got for session cookie is really serverGuid not the session string. As vSphere 4.1, the session string is no longer sent by default. To fix it, check out this thread:


  7. samir savla
    Posted August 14, 2010 at 12:45 am | Permalink

    Thanks Steve…I’ll try this out and let you know how this goes.

  8. yan
    Posted August 16, 2010 at 3:08 am | Permalink

    Hi Jin,

    Your VIJAVA is great,but I have a problem when using it(vijava2120100715.jar) as below:

    my code is:
    ServiceInstance si = new ServiceInstance(new URL(URL), USER, PASSWORD,true);
    and always throws such error:
    Exception in thread “main” java.lang.InstantiationError: com.vmware.vim25.VimPortType
    I check the source and samples but still can not find the reason,any mistaken?


  9. Posted August 16, 2010 at 9:59 am | Permalink

    Thanks Yan,

    It seems to me you may have included the stub generated from Apache AXIS in your classpath. Just remove it and give it another try.


  10. samir savla
    Posted August 18, 2010 at 12:54 pm | Permalink

    Hi Steve,

    Just wanted to update you that the fix worked and we can now discover both 4.0 and 4.1 vcenters with 4.0 vijava api’s.


  11. Posted August 18, 2010 at 11:05 pm | Permalink

    That is awesome! Thanks for the update Samir!


  12. yan
    Posted August 19, 2010 at 4:29 am | Permalink

    Hi Steve,

    Thanks.Your are right!

  13. Posted August 19, 2010 at 9:08 am | Permalink

    Thanks for the update! I am going to GA 2.1 before VMworld. Please let me know ASAP if there is any other issue so that fix can catch the release.


  14. Igor
    Posted April 20, 2011 at 5:18 am | Permalink

    Hi Steve,
    we are using the latest API in our product (vijava2120100824 package). But we got the followin bug report from the client:

    “This app does not power on my esxi vms. I get restricted version error.”

    This error is returned from the ESXi server. The client’s ESXi instance ver is 4.1 and all power ops work good in VMWare vSpere client.

    Please, advise…

  15. Igor
    Posted April 20, 2011 at 1:42 pm | Permalink

    K, checked in the doc – the client used free license ESXi server and following the doc read only access is allowed (only) in this case.

    The issue has been closed

  16. Posted April 20, 2011 at 11:00 pm | Permalink

    Good to know. -Steve

One Trackback

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>


    My company has created products like vSearch ("Super vCenter"), vijavaNG APIs, EAM APIs, ICE tool. We also help clients with virtualization and cloud computing on customized development, training. Should you, or someone you know, need these products and services, please feel free to contact me: steve __AT__

    Me: Steve Jin, VMware vExpert who authored the VMware VI and vSphere SDK by Prentice Hall, and created the de factor open source vSphere Java API while working at VMware engineering. Companies like Cisco, EMC, NetApp, HP, Dell, VMware, are among the users of the API and other tools I developed for their products, internal IT orchestration, and test automation.