ERROR: "update or delete on table "app_template" violates foreign key constraint "fk_catalog_item2app_template" on table "catalog_item"" when removing an application template
search cancel

ERROR: "update or delete on table "app_template" violates foreign key constraint "fk_catalog_item2app_template" on table "catalog_item"" when removing an application template

book

Article ID: 372652

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

  • An error occurs when you try to remove an AppTemplate from a catalog in VMware Cloud Director (VCD) and displays a message similar to:

Details : [ #########-####-####-####-############ ] Internal Server Error
 - Could not execute JDBC batch update; SQL [/* Method: unknown */ /* delete com.vmware.vcloud.common.model.contenthub.AppTemplateModel */ delete from app_template where id=?]; constraint [fk_catalog_item2app_template]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
 - Batch entry 0 /* Method: unknown */ /* Method: unknown */ /* delete com.vmware.vcloud.common.model.contenthub.AppTemplateModel */ delete from app_template where id='#########-####-####-####-############'::uuid was aborted: ERROR: update or delete on table "app_template" violates foreign key constraint "fk_catalog_item2app_template" on table "catalog_item"
  Detail: Key (id)=(#########-####-####-####-############) is still referenced from table "catalog_item".  Call getNextException to see other errors in the batch.

or

could not execute update query - ERROR: update or delete on table "app_template" violates foreign key constraint "fk_catalog_item2app_template" on table "catalog_item" Detail: Key (id)=(########-####-####-####-############) is still referenced from table "catalog_item"

  • Catalog/Media uploaded to VCD may show a not ready state.
  • Deletion of an Organization or Catalog may fail with the error:

    null id in com.vmware.vcloud.common.model.event.AuditTrailEventModel entry (don't flush the Session after an exception occurs) - null id in com.vmware.vcloud.common.model.event.AuditTrailEventModel entry (don't flush the Session after an exception occurs)

Environment

  • VMware Cloud Director 10.x

Cause

This issue occurs when there is a catalog item reference that still points to an application template, which is causing the removal of the application template to fail due to a database constraint. Such a situation may potentially occur if the vApp template creation task had failed or was cancelled midway.

Resolution

To resolve this issue, contact Broadcom Support and note this Article ID (372652) in the problem description. For more information, see Creating and managing Broadcom cases.