VIJava Browser – A Great Tool To Recommend!

February 22, 2010

While browsing the project home of VI Java API, I found a link to a great tool contributed by pitchcat. It is a standalone Java application that shows managed objects and data objects in a tree hierarchy, and all the methods attached to a managed object.

I highly recommend it to all the VI Java API developers. Why? Although you can get similar information from MOB, vijava browser gives you an overview of all the managed objects and clear paths to any managed objects or data objects. 

Here are two screen shots: 

 

Fig 1 Login Dialog

 Fig 2 Main windows of the VIJava Browser 

To download it, click here. VI Java API binary package is needed to run this application. If don’t have it yet, download it here.

Author: Steve Jin is the author of VMware VI and vSphere SDK (Prentice Hall), creator of VMware vSphere Java API. For future articles, please subscribe to Email or RSS, and follow on Twitter.

Related Posts

11 Responses to “VIJava Browser – A Great Tool To Recommend!”

  1. [...] For the best user experience, vSphere Client hides some of the elements in the real path. For example, you don’t see an element called “vm” in a VI Client inventory tree. To find out exact inventory path, use MOB or the VIJava Browser. [...]

  2. Vishal says:

    Fails to browse the HostProfiles, from HostProfileManager.
    Got the following exception.
    Caused by: java.lang.ClassCastException: [Lcom.vmware.vim25.ManagedObjectReference; cannot be cast to [Lcom.vmware.vim25.mo.Profile;
    at com.vmware.vim25.mo.ProfileManager.getProfile(ProfileManager.java:52)

    Wrote a small code to test Profile[] getProfile call in HostProfilesManager. I get the same exception. is viJava broken for HostProfiles?

    Thanks
    V

    private void testHostProfiles() {
    HostProfileManager hpm = si.getHostProfileManager();
    Profile[] profiles = hpm.getProfile(); // this call throws the exception.
    for (Profile p : profiles) {
    System.out.println(“Profile “+ p);
    }
    }
    /*
    * Method from ProfileManager.java
    public Profile[] getProfile()
    {
    return (Profile[]) getCurrentProperty(“profile”); // this is the call in ProfileManager causing the exception.
    }
    */

  3. Steve Jin says:

    Hi Vishal,

    This is a bug in vijava api. Could you please file a bug: https://sourceforge.net/tracker/?group_id=228007

    Thanks!

    Steve

  4. Steve Jin says:

    Thanks Vishal for filing the bug: https://sourceforge.net/tracker/index.php?func=detail&aid=3040909&group_id=228007&atid=1073396. It’s fixed. Check the bug record for more info.

    Steve

  5. yan says:

    Hi Setve,

    when I run this tools,it throw following error:
    Exception occurred during event dispatching:
    java.lang.InstantiationError: com.vmware.vim25.VimPortType
    at com.vmware.vim25.mo.ServiceInstance.(ServiceInstance.java:82)
    at com.vmware.vim25.mo.ServiceInstance.(ServiceInstance.java:69)
    at vijavaBrowser.LoginDialog.onOk(LoginDialog.java:256)

    I used this version vi java api:
    vijava2120100715.jar

    And I also have the same error when writing my own class when only invoke this constructor method:

    public class newtest {

    public static void main(String[] args) throws RemoteException, MalformedURLException {
    ServiceInstance si = new ServiceInstance(new URL(“https://10.10.10.147/sdk”), “root”, “password”, true);
    }

    }

    It is the same code as in the tool source code, I can not figure out why,can you help me? Cause if I can not have this “ServiceInstance” I can do nothing

  6. Steve Jin says:

    Hi Yan,

    It’s most likely a classpath issue with AXIS generated stub included in your classpath. Remove it and try again.

    -Steve

  7. Vishal says:

    Thanks Steve, for a quick fix, I am assuming i can pick it up in a patch release of 4.1.

    One more question.

    I see that when viClient reports events there is a type field {error|info|warning}, how do i get this info along with the event object, seems like event object doesnt have a severity or type field.

    Thanks
    Vishal

  8. Steve Jin says:

    Hi Vishal,
    I am going to GA the 2.1 very soon. You can either pick the source code from SVN right now or wait a little bit. I prefer the former because you can double check if the problem is solved. Please update the bug tracker upon validation.
    As you said, the event object itself does not have field for the type, but the concrete event (subtypes of Event) does indicate something. For example, HostEnableAdminFailedEvent tells the nature of the event by its type name. Hope it helps.
    Steve

  9. Vishal says:

    Steve,

    Any reason why the severity is skipped from the Event object? in our NMS tool we need to set the severity for each event, and i was planning to have it same as your Enum – EventEventSeverity. we are currently processing 87 Events, it would be tough to parse the event name to get the severity.

    is it possible to add severity to the event object?

    Thanks
    Vishal

  10. Steve Jin says:

    Hi Vishal,

    Just wrote a comprehensive blog: http://www.doublecloud.org/2010/08/how-to-get-event-type-with-vsphere-api/. Hope you find it helpful.

    Steve

  11. yan says:

    Hi Steve,
    You are right,my lib is messed up with a vim25 jar file from AXIS stub.

Leave a Reply

Page 1 of 11

OfficeFolders theme by Themocracy