Home > vSphere API > VIJava Browser – A Great Tool To Recommend!

VIJava Browser – A Great Tool To Recommend!

February 22nd, 2010 Leave a comment Go to comments

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. 

Time to learn how to "Google" and manage your VMware and clouds in a fast and secure


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.

Categories: vSphere API Tags: , , ,
  1. Vishal
    August 6th, 2010 at 11:40 | #1

    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?


    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.

  2. August 6th, 2010 at 13:29 | #2

    Hi Vishal,

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



  3. August 6th, 2010 at 18:03 | #3

    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.


  4. yan
    August 16th, 2010 at 03:32 | #4

    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:

    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(“”), “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

  5. August 16th, 2010 at 10:01 | #5

    Hi Yan,

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


  6. Vishal
    August 16th, 2010 at 18:04 | #6

    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.


  7. August 17th, 2010 at 00:23 | #7

    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.

  8. Vishal
    August 17th, 2010 at 12:47 | #8


    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?


  9. August 19th, 2010 at 00:23 | #9

    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.


  10. yan
    August 19th, 2010 at 04:27 | #10

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

  11. semmy
    June 2nd, 2011 at 03:07 | #11

    hi all,
    who can tell me how to run this VIJava Browser? i run it that reported error of “java.lang.NullPointerException”.


  12. semmy
    June 2nd, 2011 at 03:31 | #12

    hi all,
    The VIJava Browser connect to vCenter or ESX ?

  13. June 2nd, 2011 at 09:47 | #13

    Both. Better yet, ESXi too.


  14. June 2nd, 2011 at 09:48 | #14

    Want to share the stack trace?


  15. semmy
    June 2nd, 2011 at 21:57 | #15

    thanks Steve,

    F:\application>java -cp . -jar vijavaBrowser.jar
    Exception in thread “main” java.lang.NullPointerException
    at vijavaBrowser.Application.main(Application.java:420)

    the dom4j-1.6.1.jar and vijava2120100824.jar in current directory.

    thanks again
    @Steve Jin

  16. June 3rd, 2011 at 00:19 | #16

    After checking the src, I can guess why – it must be javac is null.
    419 JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
    420 JavaFileManager jfm = javac.getStandardFileManager(

    As stated in the page in http://communities.vmware.com/docs/DOC-11934, “This sample required JDK(not JRE) 6 and VMware VI (vSphere) Java API.”

    Most likely you were using JRE, or JDK for running this.


  17. semmy
    June 3rd, 2011 at 03:58 | #17

    hi Steve,
    i solved it.i used the JRE to run it so appeared error.Thanks!

    and I used VI Java API to develop application,but i don’t know how to traverse all vSwitch under the datacenter,not DistributedVirtualSwitch. and why have not the Managed Object of VirtualSwitch.

    thanks again!


  18. March 17th, 2015 at 11:27 | #18

    I took this code and put it up on Github. I made is so it compiles with Maven. I also added a distinct icon to the searchable items so it was more obvious where you could search from.

  19. March 17th, 2015 at 11:28 | #19
  1. March 29th, 2010 at 00:04 | #1