"Error: 'Unable to Process Template' When Deploying from Subscribed Content Library"
search cancel

"Error: 'Unable to Process Template' When Deploying from Subscribed Content Library"

book

Article ID: 375916

calendar_today

Updated On:

Products

VMware vCenter Server 8.0 VMware vCenter Server 7.0

Issue/Introduction

This article intends to provide resolution for deploying template from subscribed content library with the following symptoms,

  • Unable to deploy OVF template using content libraries, when choosing the compute resource an error appears "unable to process template"
  • Task fails with "Failed to deploy OVF package. Cause: A general system error occurred: Provider method implementation threw unexpected exception: query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2" .
  • When trying to sync OVF template within content library, from a subscriber error or exception is encountered.
  • In /var/log/vmware/content-library/cls.log on the vCenter server, below entry is observer:

YYYY-MM-DDThh:mm:ss | ERROR    | null             | cls-simple-activity-#     | SimpleActivityWorker           | Exception will not be handled by activity ############ (handle=11###-9##e-4##b-a##b-6f########56, entityId=<entity_id>): query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2
org.springframework.dao.IncorrectResultSizeDataAccessException: query did not return a unique result: 2; nested exception is javax.persistence.NonUniqueResultException: query did not return a unique result: 2

Cause

Duplicate entries for one or more content library items in vCenter's Database.

Resolution

To resolve this issue, the duplicate entries for content library items need to be removed

Before applying the steps below, please take a backup or an offline-snapshot (in powered-off state) of the vCenter Server Appliance . If the vCenter is part of a Linked Mode replication setup, please refer to VMware vCenter in Enhanced Linked Mode pre-changes snapshot (online or offline) best practice

We strongly recommend contacting Broadcom technical support, as deleting incorrect entries may corrupt the database and make vCenter inaccessible.

  1. Connect to the vCenter via SSH and login as root.
  2. Stop the content library and vpxd services using the below commands,
    • service-control --stop vmware-content-library

    • service-control --stop vpxd

  3. Connect with VCDB using the below command,
    • /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres
  4. Use the entity ID observed from cls.log and run the below query to verify duplicate entries
    • SELECT * FROM cl_libraryitem_certificate_verification certInfo WHERE certInfo.itemId = '<entity_id>';
    • Sample Output : You should see multiple duplicate entries for same Item ID


  5. Delete the duplicate entry by executing the below command, (NOTE: Kindly do not delete the library items directly from tables. Item info is not stored alone in the cl_libraryitem_certificate_verification and there are other tables as well like cl_libraryitemversion, cl_libraryitem etc. Deleting items this way can leave the entries in inconsistent state.

    • DELETE FROM cl_libraryitem_certificate_verification cert_ver_old USING (SELECT MIN(ctid) as ctid, itemId FROM cl_libraryitem_certificate_verification GROUP BY itemId HAVING COUNT(*) > 1) cert_ver_new WHERE cert_ver_new.itemId = cert_ver_old.itemId AND cert_ver_new.ctid <> cert_ver_old.ctid;

    • Sample output :  You should see "DELETE 1" once the command runs successfully and deletes the duplicate entry 


  6. Verify that duplicate entry has been successfully deleted by executing the command shared on Step 4.
  7. Quit the VCDB using below command:  \q

  8. Start the stopped vCenter services by using the command:  service-control --start vmware-content-library && service-control --start vpxd

  9. Re-sync the OVF template within the content library.

  10. Once the sync is finished, re-attempt the OVF deployment.