Hi,
In our project we communicate with vCenter/ESX to get the Virtualmachine Details, using java API of VI SDK 4.00.
When we call the API "retrieveServiceContent(serviceInstance)" for the first time in our Application, we frequently get an error:
java.lang.OutOfMemoryError: PermGen space
To avoid this error we have set following jvm parameter
-XX:MaxPermSize=256m
And the error has stopped comming so frequently.
But we will not have the control of deplyment environment (jvm parameters for memory) in production and any memory parameters.
The value in the deployment will be -XX:MaxPermSize=128m
So, can any one please help me in avoiding the error without changing the PermSize.
The code I am using to communicate with VC/ESX is
VimServiceLocator _locator = new VimServiceLocator();
_locator.setMaintainSession(true);
VimPortType _service = _locator.getVimPort(new URL(address));
ManagedObjectReference _svcRef = new ManagedObjectReference();
svcRef.setvalue("ServiceInstance");
_svcRef.setType("ServiceInstance");
ServiceContent _sic = service.*+retrieveServiceContent_+*(_svcRef);
Thank you,
Deepak
I think it's an issue of Apache. Instead of solving the problem, you want to try the open source VI Java API (see my signature for links). It use much less memory and no memory leak at all. I believe after switching, you won't have this issue unless other part of you app demands too much memory. As a bonus, VI Java is much faster than AXIS.
Steve JIN
Author of VMware VI and vSphere SDK (Prentice Hall)
Creator of open source vSphere (VI) Java API
I think it's an issue of Apache. Instead of solving the problem, you want to try the open source VI Java API (see my signature for links). It use much less memory and no memory leak at all. I believe after switching, you won't have this issue unless other part of you app demands too much memory. As a bonus, VI Java is much faster than AXIS.
Steve JIN
Author of VMware VI and vSphere SDK (Prentice Hall)
Creator of open source vSphere (VI) Java API