Editing the configuration of a VM using vSphere Client in vSphere 7.0 fails with "object is not an instance of declaring class"
search cancel

Editing the configuration of a VM using vSphere Client in vSphere 7.0 fails with "object is not an instance of declaring class"

book

Article ID: 326258

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

Symptoms:

Trying to edit the configuration of a virtual machine using vSphere Client in vCenter 7.0 Update 3 fails with the following error:

java.lang.IllegalArgumentException: object is not an instance of declaring class


/var/log/vmware/vsphere-ui/logs/vsphere_client_virgo.log contains the following error:

vsphere_client_virgo.log
...
[2022-05-09T10:44:00.828Z] [ERROR] http-nio-5090-exec-227       70042679 100600 200048 com.vmware.vsphere.client.vm.impl.VmMutationProvider              Could not reconfigure VM urn:vmomi:VirtualMachine:vm-43618:456b7d82-1767-4aa6-82ea-dd8ba6095b84 com.vmware.vim.vmomi.client.exception.InternalException: java.lang.IllegalArgumentException: object is not an instance of declaring class
at com.vmware.vim.vmomi.core.types.impl.ComplexTypeFieldImpl.get(ComplexTypeFieldImpl.java:103)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalSubFields(MarshallerImpl.java:617)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalComplexField(MarshallerImpl.java:601)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalFault(MarshallerImpl.java:348)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalField(MarshallerImpl.java:315)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalSubFields(MarshallerImpl.java:631)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalComplexField(MarshallerImpl.java:601)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalField(MarshallerImpl.java:309)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalSubFields(MarshallerImpl.java:631)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalComplexField(MarshallerImpl.java:601)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshalField(MarshallerImpl.java:309)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl$MarshalContext.marshal(MarshallerImpl.java:194)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl.marshal(MarshallerImpl.java:139)
at com.vmware.vim.vmomi.core.soap.impl.marshaller.MarshallerImpl.marshal(MarshallerImpl.java:113)
at com.vmware.vim.vmomi.client.common.impl.RequestImpl.writeRequestBody(RequestImpl.java:63)
(...)
Caused by: java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.vmware.vim.vmomi.core.types.impl.ComplexTypeFieldImpl.get(ComplexTypeFieldImpl.java:101)
... 280 common frames omitted

 


Environment

VMware vSphere ESXi 7.0.x
VMware vCenter Server 7.0.x

Cause

This issue is being caused by a failed attempt to upgrade the virtual machines hardware version in the past. Due to the failed upgrade, an informational line was added to the .vmx configuration file of the VM:

virtualHW.scheduledUpgrade.state = "failed"


The VM reconfiguration API used by vSphere Client to edit the virtual machines settings tries to handle this as a configuration setting and fails, leading to the error mentioned above.

Resolution

This issue has been fixed in vCenter Server 7.0 Update 3i

Workaround:

As a workaround, remove the problematic line from the .vmx configuration file, by applying the following steps:

  1. Power off the Virtual Machine that has the problem.

  2. Connect to the ESXi host where the VM is running, using SSH. 

  3. Change into the the virtual machine directory, using the following command:

    # cd /vmfs/volumes/<datastore>/<VM_name>

     

  4. Edit the virtual machine configuration file <vm_name>.vmx using the "vi" text editor and remove the line below. For more information, see Editing files on an ESXi host using vi (1020302)

    virtualHW.scheduledUpgrade.state = "failed"
    
  5. Run the following command on the ESXi to identify the ID of the virtual machine (the first column in the output will be the VM ID):

    # vim-cmd vmsvc/getallvms
    
  6. Use the ID to reload the virtual machine configuration:

    # vim-cmd vmsvc/reload <Vmid>
    

For example:

# vim-cmd vmsvc/reload 14
  1. Log out of the vSphere Client and log back in. Now the VM settings can be edited successfully.