Custom attribute to VM ware Vsphere using Java SDK
up vote
0
down vote
favorite
I am trying to add a new custom attribute to VM ware vSphere using VMware JAVA SDK but it is throwing "InvalidType" exception.
com.vmware.vim25.InvalidType
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:205)
at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:82)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:134)
at com.vmware.vim25.ws.VimStub.addCustomFieldDef(VimStub.java:284)
at com.vmware.vim25.mo.CustomFieldsManager.addCustomFieldDef(CustomFieldsManager.java:57)
at vmwaretest.Connect.setSelectedVM(Connect.java:85)
at vmwaretest.Connect.main(Connect.java:29)
Code
ServiceInstance si = null;
try
si = Initialisation(url, user, password);
catch (RemoteException e)
e.printStackTrace();
catch (MalformedURLException e)
e.printStackTrace();
ServerConnection serverConnection = si.getServerConnection();
ManagedObjectReference mor = si.getMOR();
CustomFieldsManager cfm = new CustomFieldsManager(serverConnection, mor);
try
cfm.addCustomFieldDef("type", null, null, null);
catch (DuplicateName e)
e.printStackTrace();
catch (InvalidPrivilege e)
e.printStackTrace();
catch (RuntimeFault e)
e.printStackTrace();
catch (RemoteException e)
e.printStackTrace();
Connection to the vSphere is working fine as I am able to retrieve or change the already existing Custom attributes but not able to create a new one.
What is wrong with the above code? Or is there any other way to add new custom attribute using vmware Java SDK.
CustomFieldsManager doc https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.pg.doc%2FPG_Appx_Privileges_Reference.23.2.html
vmware vsphere vmware-sdk
add a comment |
up vote
0
down vote
favorite
I am trying to add a new custom attribute to VM ware vSphere using VMware JAVA SDK but it is throwing "InvalidType" exception.
com.vmware.vim25.InvalidType
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:205)
at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:82)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:134)
at com.vmware.vim25.ws.VimStub.addCustomFieldDef(VimStub.java:284)
at com.vmware.vim25.mo.CustomFieldsManager.addCustomFieldDef(CustomFieldsManager.java:57)
at vmwaretest.Connect.setSelectedVM(Connect.java:85)
at vmwaretest.Connect.main(Connect.java:29)
Code
ServiceInstance si = null;
try
si = Initialisation(url, user, password);
catch (RemoteException e)
e.printStackTrace();
catch (MalformedURLException e)
e.printStackTrace();
ServerConnection serverConnection = si.getServerConnection();
ManagedObjectReference mor = si.getMOR();
CustomFieldsManager cfm = new CustomFieldsManager(serverConnection, mor);
try
cfm.addCustomFieldDef("type", null, null, null);
catch (DuplicateName e)
e.printStackTrace();
catch (InvalidPrivilege e)
e.printStackTrace();
catch (RuntimeFault e)
e.printStackTrace();
catch (RemoteException e)
e.printStackTrace();
Connection to the vSphere is working fine as I am able to retrieve or change the already existing Custom attributes but not able to create a new one.
What is wrong with the above code? Or is there any other way to add new custom attribute using vmware Java SDK.
CustomFieldsManager doc https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.pg.doc%2FPG_Appx_Privileges_Reference.23.2.html
vmware vsphere vmware-sdk
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to add a new custom attribute to VM ware vSphere using VMware JAVA SDK but it is throwing "InvalidType" exception.
com.vmware.vim25.InvalidType
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:205)
at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:82)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:134)
at com.vmware.vim25.ws.VimStub.addCustomFieldDef(VimStub.java:284)
at com.vmware.vim25.mo.CustomFieldsManager.addCustomFieldDef(CustomFieldsManager.java:57)
at vmwaretest.Connect.setSelectedVM(Connect.java:85)
at vmwaretest.Connect.main(Connect.java:29)
Code
ServiceInstance si = null;
try
si = Initialisation(url, user, password);
catch (RemoteException e)
e.printStackTrace();
catch (MalformedURLException e)
e.printStackTrace();
ServerConnection serverConnection = si.getServerConnection();
ManagedObjectReference mor = si.getMOR();
CustomFieldsManager cfm = new CustomFieldsManager(serverConnection, mor);
try
cfm.addCustomFieldDef("type", null, null, null);
catch (DuplicateName e)
e.printStackTrace();
catch (InvalidPrivilege e)
e.printStackTrace();
catch (RuntimeFault e)
e.printStackTrace();
catch (RemoteException e)
e.printStackTrace();
Connection to the vSphere is working fine as I am able to retrieve or change the already existing Custom attributes but not able to create a new one.
What is wrong with the above code? Or is there any other way to add new custom attribute using vmware Java SDK.
CustomFieldsManager doc https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.pg.doc%2FPG_Appx_Privileges_Reference.23.2.html
vmware vsphere vmware-sdk
I am trying to add a new custom attribute to VM ware vSphere using VMware JAVA SDK but it is throwing "InvalidType" exception.
com.vmware.vim25.InvalidType
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.vmware.vim25.ws.XmlGen.fromXml(XmlGen.java:205)
at com.vmware.vim25.ws.XmlGen.parseSoapFault(XmlGen.java:82)
at com.vmware.vim25.ws.WSClient.invoke(WSClient.java:134)
at com.vmware.vim25.ws.VimStub.addCustomFieldDef(VimStub.java:284)
at com.vmware.vim25.mo.CustomFieldsManager.addCustomFieldDef(CustomFieldsManager.java:57)
at vmwaretest.Connect.setSelectedVM(Connect.java:85)
at vmwaretest.Connect.main(Connect.java:29)
Code
ServiceInstance si = null;
try
si = Initialisation(url, user, password);
catch (RemoteException e)
e.printStackTrace();
catch (MalformedURLException e)
e.printStackTrace();
ServerConnection serverConnection = si.getServerConnection();
ManagedObjectReference mor = si.getMOR();
CustomFieldsManager cfm = new CustomFieldsManager(serverConnection, mor);
try
cfm.addCustomFieldDef("type", null, null, null);
catch (DuplicateName e)
e.printStackTrace();
catch (InvalidPrivilege e)
e.printStackTrace();
catch (RuntimeFault e)
e.printStackTrace();
catch (RemoteException e)
e.printStackTrace();
Connection to the vSphere is working fine as I am able to retrieve or change the already existing Custom attributes but not able to create a new one.
What is wrong with the above code? Or is there any other way to add new custom attribute using vmware Java SDK.
CustomFieldsManager doc https://pubs.vmware.com/vsphere-6-5/index.jsp?topic=%2Fcom.vmware.wssdk.pg.doc%2FPG_Appx_Privileges_Reference.23.2.html
vmware vsphere vmware-sdk
vmware vsphere vmware-sdk
asked Nov 8 at 19:06
Mayank Goyal
33
33
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53214532%2fcustom-attribute-to-vm-ware-vsphere-using-java-sdk%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown