Unable to delete a content source in VMware Service Broker
search cancel

Unable to delete a content source in VMware Service Broker

book

Article ID: 318359

calendar_today

Updated On:

Products

VMware Aria Suite

Issue/Introduction

Symptoms:
  • When an administrator tries to delete a content source in Service Broker, an Internal Server Error is seen in the UI and a log exception is generated similar to the entry Unable to deserialize object value from JSON within the snippet below:
    2021-xx-xxT15:08:41.573Z INFO catalog-service-app [host='catalog-service-app-id' thread='http-nio-8000-exec-24' user='mssid' org='<Org id>' trace='<trace id>'] c.v.t.c.s.CatalogSourceServiceImpl - Deleting CatalogSource(id=<catalog id>) 2021-xx-xxT15:08:41.583Z ERROR catalog-service-app [host='catalog-service-app-id' thread='http-nio-8000-exec-24' user='mssid' org='<Org id>' trace='<trace id>'] c.v.s.webmvc.error.RestExceptionHandler - Internal Error com.vmware.symphony.webmvc.error.exception.InternalErrorException: Internal Server Error [Error Reference ID: {<error id>}]
    at com.vmware.symphony.webmvc.error.exception.InternalErrorException.wrap(InternalErrorException.java:36)
    Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Unable to deserialize object value from JSON: {"type": "object", "required": ["disks"], "properties": {"disks": {"type": "array", "items": {"type": "object", "maxItems": 5, "properties": {"size": {"type": "number", "title": "Size GB", "maximum": 1024.0, "minimum": 1.0}, "mountpoint": {"type": "string", "title": "Mountpoint/Drive Letter"}}}, "title": "Disks", "description": "Data disk mount points and sizes"}, "cpuCount": {"type": "integer", "oneOf": [{"const": 2, "title": "2"}, {"const": 4, "title": "4"}, {"const": 8, "title": "8"}], "default": 2, "maximum": 8, "minimum": 2}, "totalMemoryMB": {"enum": [1024.0], "type": "number", "title": "Memory", "default": 1024, "maximum": 8192.0, "minimum": 1024.0}}}; nested exception is
    java.lang.IllegalArgumentException: Unable to deserialize object value from JSON: {"type": "object", "required": ["disks"], "properties": {"disks": {"type": "array", "items": {"type": "object", "maxItems": 5, "properties": {"size": {"type": "number", "title": "Size GB", "maximum": 1024.0, "minimum": 1.0}, "mountpoint": {"type": "string", "title": "Mountpoint/Drive Letter"}}}, "title": "Disks", "description": "Data disk mount points and sizes"}, "cpuCount": {"type": "integer", "oneOf": [{"const": 2, "title": "2"}, {"const": 4, "title": "4"}, {"const": 8, "title": "8"}], "default": 2, "maximum": 8, "minimum": 2}, "totalMemoryMB": {"enum": [1024.0], "type": "number", "title": "Memory", "default": 1024, "maximum": 8192.0, "minimum": 1024.0}}}
    Caused by: java.lang.IllegalArgumentException: Unable to deserialize object value from JSON: {"type": "object", "required": ["disks"], "properties": {"disks": {"type": "array", "items": {"type": "object", "maxItems": 5, "properties": {"size": {"type": "number", "title": "Size GB", "maximum": 1024.0, "minimum": 1.0}, "mountpoint": {"type": "string", "title": "Mountpoint/Drive Letter"}}}, "title": "Disks", "description": "Data disk mount points and sizes"}, "cpuCount": {"type": "integer", "oneOf": [{"const": 2, "title": "2"}, {"const": 4, "title": "4"}, {"const": 8, "title": "8"}], "default": 2, "maximum": 8, "minimum": 2}, "totalMemoryMB": {"enum": [1024.0], "type": "number", "title": "Memory", "default": 1024, "maximum": 8192.0, "minimum": 1024.0}}}
    Caused by: com.fasterxml.jackson.databind.JsonMappingException: Schema type must be ARRAY at [Source: (String)"{"type": "object", "required": ["disks"], "properties": {"disks": {"type": "array", "items": {"type": "object", "maxItems": 5, "properties": {"size": {"type": "number", "title": "Size GB", "maximum": 1024.0, "minimum": 1.0}, "mountpoint": {"type": "string", "title": "Mountpoint/Drive Letter"}}}, "title": "Disks", "description": "Data disk mount points and sizes"}, "cpuCount": {"type": "integer", "oneOf": [{"const": 2, "title": "2"}, {"const": 4, "title": "4"}, {"const": 8, "title": "8"}], "defau"[truncated 166 chars]; line: 1, column: 125] (through reference chain: com.vmware.json.schema.model.JsonSchemaBuilder["properties"]->java.util.LinkedHashMap["disks"]->com.vmware.json.schema.model.JsonSchemaBuilder["items"]->com.vmware.json.schema.model.JsonSchemaBuilder["maxItems"])
    
 


Environment

VMware vRealize Automation 8.3.x

Cause

In vRA 8.3, JSON schema validations were added.  If any pre-existing templates are the wrong type, an exception is thrown during deserialization.

Resolution

This issue is resolved in vRealize Automation 8.4 GA.

Workaround:
  1. SSH or PuTTY to a vRA appliance within the cluster
  2. Enter psql developer mode
    vracli dev psql
  3. Find the catalog source id
    select id from cat_catalogsource where name='<name-of-content-source>';
    Exampleselect id from cat_catalogsource where name='Cloud Admins';
    
  4. Find all the catalog items associated with the above source id
    select id from cat_catalogitem where source_id='<copy-source-id-from-step-1>';
    Example: select id from cat_catalogitem where source_id='xxxxxxxx-xxxx-xxxx-xxx-xxxxxxxxxxxx';
  5. For each of the items above, find the catalog item versions
    select id,name,schema from cat_catalogitemversion where item_id='<copy-item-id-from-step-2>';
  6. For each of the records above, delete all the versions of the catalog item.
    1. Run this for all the items found in Step #2
      delete from cat_catalogitemversion where item_id='<copy-item-id-from-step-2>';
      Note:  If 3 items are found, execute this 3 times or the query can be modified as follows within the WHERE clause
      delete from cat_catalogitemversion where item_id IN ('id1', 'id2', 'id3');
      where id1, id2, id3 is each item found in Step #2
      
  7. Delete from cat_entitlement table where source is linked
    delete from cat_entitlement where source_id = '<copy-source-id-from-step-1>';
  8. Delete from cat_entitlement where all the items is linked.  Run this for all the items found in Step #1
    delete from cat_entitlement where item_id = '<copy-item-id-from-step-2>';
  9. Delete all the catalog items associated with source
    delete from cat_catalogitem where source_id='<copy-source-id-from-step-1>';
  10. Once you have deleted all the catalog items, you can either delete the source via the UI or run the below command
    delete from cat_catalogsource where name='<name-of-content-source>';


Additional Information

Impact/Risks:
The workaround provided includes manual edits to the running database.  Please ensure there are valid backups or fresh snapshots available to roll back to in the event of any issue.