"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"  Other templates are deploying fine, this is a new issue with this newly created template"
  • When trying to sync OVF template within content library, from a subscriber an exception is encountered.
  • In /var/log/vmware/content-library/cls.log
    • YYYY:MM:DD | ERROR    | xx-xx-xx-xx-xx-xx-xx | cls-simple-activity-19    | SimpleActivityWorker           | Exception will not be handled by activity (handle=xxxxxxxxxxxxxxxxxxxxx, entityId=xxxxxxxxxxxxxxxxxxxxxxx): 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 the content library items in vCenter's Database.

Resolution

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 backup/offline snapshots of all the replicating nodes as well.

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 command,
    1. service-control --stop vmware-content-library
    2. service-control --stop vpxd
  3. Connect with VCDB using the below command,
    1. /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres
  4. Note down the entity ID from cls.log and run the below query to verify duplicate entries,
    1. SELECT * FROM cl_libraryitem_certificate_verification certInfo WHERE certInfo.itemId = 'xxxxxxxxxxxxxxxxxxxxxxxx';
  5. Once you confirms that there are duplicate entries, Kindly run the below command to delete them, (NOTE: Kindly do not delete the library items directly from tables. Item info is not stored alone in the cl_libraryitem_certificate_verification there are other tables as well like cl_libraryitemversion, cl_libraryitem etc. Deleting items this way will leave the entries in inconsistent state.
    1. 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;
  6. Quit the VCDB using \q
  7. Start the vpxd and content library service using,
    1. service-control --start --all
  8. Re-sync the OVF template within the content library.
  9. Once the sync is finished, re-attempt the OVF deployment.