Open Source VI Java API 5.0.1 Released
While preparing this annoucement, I realize that on the same day last year we had a very successful community event with several techtalks to celebrate the 3 year of vijava open source project. Today it’s the 4th year of this project!
Since VI Java API 5.0 GAed last October, there have been some changes, one of which is that I left VMware and joined VCE the same month. On the project side, there are several new bugs opened with the forum. These bugs do not affect most developers. But still I fixed them quickly in the code repository so that anyone who was affected could get the fixes from there.
As the fixes accumulate, I thought it’s a good idea to push out a minor release. Therefore I called for new bugs in March with my tweets. Surprisingly, I haven’t seen any coming up after that. That doesn’t mean that vijava API is perfect now, but that vijava is quite stable given our large developer/administrator community.
Anyway, here is a list of the bug fixes getting in 5.0.1 release and short description of the solutions.
- 3499323 WSClient fails to parse float in StorageMigrationAction
Solution: add the code to parse float which is an easy fix with clean code structure of vijava engine. - 3497202 StorageResourceManager constructor missing
Solution: add the contructor code. This is the simplest fix. - 3496063 XmlGen.getVimClass(…) is not thread safe
Solution: change the HashMap for classes to the thread safe equivalent. - 3461462 ScheduledTask Clone – The root cause is the serialization of ManagedObjectReference object is not correct.
Solution: add xsi:type attribute to the XML entity.
If your application works fine with previous release, you don’t need to upgrade to this 5.0.1. If you upgrade, you do need to change your product notice to include one more line of copyright by me. For details, just check out the License.txt. The BSD license for vijava API remains the same as before. To download, click here.

Hi Steve,
The vijava jar files that you release do not have source within them. Do you export a separate version that has source bundled (at them time of release)?
regards,
Shobhit
There are two different files – one binary with *.zip extension, the other source with *.jar extension. Please go get the latter one.
Steve
Hi Steve,
I’m not sure it is OK to raise my question here for a bug I found with VI Java API 5.0. I already filed a bug on vijava bugzilla:
http://sourceforge.net/tracker/?func=detail&aid=3528779&group_id=228007&atid=1073396
SearchDatastore.java failed with exception: InvalidRequest – ID: 3528779
Run sample code SearchDatastore.java and throwed the following exception:
Exception in thread “main” com.vmware.vim25.InvalidRequest
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at java.lang.Class.newInstance0(Class.java:372)
at java.lang.Class.newInstance(Class.java:325)
at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:201)
at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:80)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:133)
at com.vmware.vim25.ws.VimStub.searchDatastoreSubFolders_Task(VimStub.java:2602)
at com.vmware.vim25.mo.HostDatastoreBrowser.searchDatastoreSubFolders_Task(HostDatastoreBrowser.java:81)
at com.vmware.vim25.mo.samples.storage.SearchDatastore.main(SearchDatastore.java:117)
Since I already write some code to verify this and found that HostDatastoreBrowser.searchDatastoreSubFolders_Task always throws the same exception.
Your comments?
Thanks.
Hi Kenny,
Thanks for reporting the bug! The InvalidRequest exception means the application does not pass the expected argument, therefore fails the method call. You may want to double check your application code. Please let me know of any update.
Steve
@Steve Jin
Thanks for your quick response.
I only changed the following part of sample java code: SearchDatastore.java
String hostname = “my.domain.com”;
String datastorePath = “[ds-1_LUN34]“;
This part is hardcoded in SearchDatasotre.java and I changed it according to my setup. Then I met that problem.
Hi Kenny,
There are two arguments to the searchDatastoreSubFolders_Task() method. You may want to double check what you passed in against what is required in the API reference. You can also check server side log to see if there is any additional hints.
Good luck!
Steve
@Steve Jin
Thanks for your reply. I will double check this. If sample code src/com/vmware/vim25.mo/samples/storage/SearchDatastore.java in 5.0 release works for you, it should works for me by just changing hostname and datastorePath.
Anyway, I will do some debugging and see what happened.
-Kenny
Hi Steve
Just wondering if there is any incremental update to the automatic code generator that coincides with this vijava release? In particular with respect to python and/or ruby support?
Thanks
Don
This release is really bug fixes. The underlying interfaces have not changed at all.
Steve
Thanks Steve! The fixes for issues 3499323 and 3497202 allowed me to add Storage DRS support to HP Operations Orchestration Content Pack 8!
Great to hear that Dan!
Steve
Has the new vijava 5.0.1 release been pushed to a public maven repository anywhere?
Good question. Not yet.
Steve
@Steve Jin
Do you plan to publish it? I think it’s better for the project owner to publish it. When I search the web, I’ve got this for 5.0.0, “http://mvnrepository.com/artifact/com.cloudbees.thirdparty/vijava/5.0.0″. It looks strange that the package name belongs to some thirdparty company.
Thanks for the information. I think I should do that. Cloudbee propably uses vijava in their project.
Steve
Cloudbee only has vijava 5.0.0 in their Maven repo
Steve,
I am working on someone else’s Java code for reading MOB information. I have tried your library but ran into a difference between your library and the one that is on the VMware site. Your library does not support serialization of the objects, which turns out, is important to us. Needless to say, it allows us to grab data from a customer site and use that data to debug any errors we see on the customer site that we can’t reproduce with any of our servers. Unfortunately, the vim25.jar file from VMware does not include the mo package, and, unfortunately, your library has serialization stripped out. Is there a version with serialization or can you point me somewhere to find the mo package with serialization enabled? Any help would be greatly appreciated.
Thanks,
Marty
Hi Marty,
Thansk for the feedback. Can you file feature request in the vijava.sf.net project tracker? Let’s track it from there.
Steve
Done, thanks.
Hi Steve Jin,
I have a look at your book.In charpter performance monitoring,I know that the PerfMetricId is the instance of counterId in the server.But I search that there is no PerfMetric info about Memory in my ESXi server.So I new a PerfMetric,”new PerfMetric(null,null,5,true)”.It also works.So I want to know why we need to check the corresponding instance Metric of the counter.Your code and sdk code both need get Metric throught counter,but I test,it return size is 0.So the PerfQuerySpec.setMetric() set the default metric.so the program return data about all the instance.My English is poor.my description maybe unclear.Please do me a favor,thanks!
Hi Steven Jin,
I have figure out the difference.”new PerfMetric(null,null,5,true)”just point to one instance that is not definited.Also thanks you for your book.