Getting the error java.lang.NullPointerException when trying to add new licenses in vSphere Client
search cancel

Getting the error java.lang.NullPointerException when trying to add new licenses in vSphere Client

book

Article ID: 417455

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

  • Adding a New License from vSphere Client shows the error message java.lang.NullPointerException.



  • Selecting Licenses shows empty result (No items found)



  • vSphere Client logs shows below errors :

    /var/log/vmware/vsphere-ui/logs/vsphere_client_virgo.log

    [YYYY-MM-DDTHH:MM:SS.###] [ERROR] data-service-pool-761        70023604 103098 200446 c.vmware.license.client.cis.adapter.BaseDataProviderAdapterImpl   Unable to retrieve licensing data:  com.vmware.vim.binding.vmodl.fault.SystemError: java.lang.NullPointerException
            at com.vmware.license.client.cis.management.impl.ManagementEditorImpl.searchLicenseUtilizations(ManagementEditorImpl.java:922)

  • License service log shows below errors :

    /var/log/vmware/cis-license/license.log

    YYYY-MM-DDTHH:MM:SS.### vmomi-executor-1   ERROR vim.vmomi.server.impl.SoapBindingImpl Method 'searchLicenseUtilizations' completed with undeclared fault of type java.lang.NullPointerException: null

Environment

vCenter Server 8.x

Cause

  • This issue is caused when invalid entries related to vSphere+ licenses are stored in License service asset information.
  • License service logs will show which entry is causing the problem when DEBUG logging is enabled (steps to enable debug logging is available in Additional Information section) 

    /var/log/vmware/cis-license/license.log

    YYYY-MM-DDTHH:MM:SS.###Z invocation-vmomi-executor-1 operationID=<opID>  DEBUG server.common.repository.impl.LdapRepositoryImpl Searching using filter: (&(&(vmwLicSvcAssetProductName=VMware VirtualCenter Server)(vmwLicSvcAssetLicenseId=9#######-c###-3###-b###-4###########))(vmwLicSvcObjectClass=AssetEntity))
    YYYY-MM-DDTHH:MM:SS.###Z invocation-vmomi-executor-1 operationID=<opID>  ERROR vim.vmomi.server.impl.InvocationTask Method invocation threw unexpected exception!
    java.lang.NullPointerException: null

Resolution

Remove the stale license entries by following below steps :

  1. SSH to vCenter Server with 'root' account.
  2. Change shell to bash using command 'shell".
  3. Execute below command to list the vSphere+ license and note down the value of "dn :" parameter.

    ldapsearch -H ldap://localhost -x -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -W -b "cn=LicenseService,cn=Services,dc=vsphere,dc=local" -o ldif-wrap=no -s sub "(&(objectclass=vmwLicSvcLicenseEntity)(vmwLicSvcLicenseType=SubscriptionLicense)(vmwLicSvcLicenseName=vSphere+))"

    Sample Result:
    # LicenseEntity_9#######-c###-3###-b###-4###########, LicenseService, Services,vsphere.local
    dn: cn=LicenseEntity_9#######-c###-3###-b###-4###########,cn=LicenseService,cn=Services,dc=vsphere,dc=local
    vmwLicSvcObjectClass: LicenseEntity
    vmwLicSvcLicenseType: SubscriptionLicense
    vmwLicSvcLicenseName: vSphere+
    vmwLicSvcLicenseId: 9#######-c###-3###-b###-4###########
    objectClass: top
    objectClass: vmwLicSvcLicenseEntity
    cn: LicenseEntity_9#######-c###-3###-b###-4###########

    Note: Change the domain name based on the environment. In the above example, vsphere.local is used as the domain name.

  4. Execute below ldapdelete command to delete the license entry. It will prompt for administrator password and will not give any message if the operation is successful.

    ldapdelete -H ldap://localhost -x -D "cn=administrator,cn=users,dc=vsphere,dc=local" -W "cn=LicenseEntity_<AssetID>,cn=LicenseService,cn=services,dc=vsphere,dc=local"

    Sample command:
    ldapdelete -H ldap://localhost -x -D "cn=Administrator,cn=Users,dc=vsphere,dc=local" -W "cn=LicenseEntity__9#######-c###-3###-b###-4###########,cn=LicenseService,cn=Services,dc=vsphere,dc=local"

    Note: Replace the string "<AssetID>" with the ID from Step 3.

  5. Restart the license service

    service-control --restart cis-license

  6. Logout and login back to vSphere Client.
  7. Retry the License management task.

Additional Information

Steps to enable License service DEBUG logging on vCenter Server:

  • SSH to vCenter Server as root account
  • Take a backup of log configuration file

    cp /etc/vmware-cis-license/log4j.properties /etc/vmware-cis-license/log4j.properties_backup_<date>

  • Edit the file /etc/vmware-cis-license/log4j.properties using 'vi' editor

    Change the line
    rootLogger.level = info

    To:

    rootLogger.level = debug

  • Restart license service

    service-control --restart cis-license