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 an 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 stack:
    [<timestamp>] [ERROR] http-nio-5090-exec-227       ######## ###### ###### com.vmware.vsphere.client.vm.impl.VmMutationProvider              Could not reconfigure VM urn:vmomi:VirtualMachine:vm-###:########-####-####-####-############# 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 vCenter Server 7.0.x
  • VMware vSphere ESXi 7.0.x

Cause

This issue occurs when there was a failed attempt to upgrade the virtual machines hardware version in the past.
During 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 is fixed in vCenter Server 7.0 Update 3i.

If an update is currently not possible, as a workaround manually remove the problematic line for the .vmx configuration file of the virtual machine:

  1. Power off the Virtual Machine (VM) which experiences the problem.
  2. Open an SSH connection with the ESXi host where the VM is running and log in using the root account.
  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:
    # vi <vm_name>.vmx
  5. Find and remove the line below:
    virtualHW.scheduledUpgrade.state = "failed"
    Note: For more information on using VI see Modifying host entry in /etc/hosts file for vCenter or ESXi host using vi editor.
  6. Identify the ID of the VM by running the following command on the ESXi (the first column in the output will be the VM ID):
    # vim-cmd vmsvc/getallvms
  7. Using this ID, reload the virtual machine configuration with:
    # vim-cmd vmsvc/reload <ID>
    For example:
    # vim-cmd vmsvc/reload 14
  8. Log out of vSphere Client and log back in. Now the VM settings can be edited successfully.

If the issue is seen with a vCenter version newer than 7.0 Update 3i, contact Broadcom support for assistance.