egeria: [BUG] ClassCastException at getSchemaTypeForElement (Asset-Manager)
Existing/related issue?
No response
Current Behavior
When we try to get the schema type through the REST or Java API (LineageIntegratorContext) the egeria server returns an error message with a ClassCastException.
POST
{{mds-baseURL}}/servers/{{mds-server}}/open-metadata/access-services/asset-manager/users/{{user}}/parents/{{asset-type}}/{{asset-guid}}/schema-types/retrieve?forLineage=true&forDuplicateProcessing=true
with body
{ “effectiveTime”: null, “assetManagerGUID” : “{{asset-manager-guid}}”, “assetManagerName”: “{{asset-manager-name}}” }
Response
{
"class": "SchemaTypeElementResponse",
"relatedHTTPCode": 500,
"exceptionClassName": "org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException",
"exceptionCausedBy": "java.lang.ClassCastException",
"actionDescription": "getSchemaTypeForElement",
"exceptionErrorMessage": "OMAG-GENERIC-HANDLERS-500-001 An unsupported bean class named org.odpi.openmetadata.accessservices.assetmanager.metadataelements.SchemaTypeElement was passed to the repository services by the getSchemaTypeForElement request for open metadata access service Asset Manager OMAS on server mds1; error message was: class org.odpi.openmetadata.accessservices.assetmanager.metadataelements.SchemaTypeElement cannot be cast to class org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaTypeProperties (org.odpi.openmetadata.accessservices.assetmanager.metadataelements.SchemaTypeElement and org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaTypeProperties are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @7b69c6ba)",
"exceptionErrorMessageId": "OMAG-GENERIC-HANDLERS-500-001",
"exceptionErrorMessageParameters": [
"org.odpi.openmetadata.accessservices.assetmanager.metadataelements.SchemaTypeElement",
"getSchemaTypeForElement",
"Asset Manager OMAS",
"mds1",
"class org.odpi.openmetadata.accessservices.assetmanager.metadataelements.SchemaTypeElement cannot be cast to class org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaTypeProperties (org.odpi.openmetadata.accessservices.assetmanager.metadataelements.SchemaTypeElement and org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaTypeProperties are in unnamed module of loader org.springframework.boot.loader.LaunchedURLClassLoader @7b69c6ba)"
],
"exceptionSystemAction": "The system is unable to process the request because it is not able to instantiate the bean.",
"exceptionUserAction": "Correct the code that initializes the converter during server start up."
}
Before we created the SchemaTypeChoice (type: EventTypeList) with the SchemaType (type: EventType) the following way:
private void ensureSchemaIsCatalogued(LineageEventContentforSample.AssetFromJSON assetFromJSON, String assetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException {
SchemaTypeChoiceProperties schemaTypeChoiceProperties = new SchemaTypeChoiceProperties();
schemaTypeChoiceProperties.setQualifiedName(assetFromJSON.getQualifiedName() + "-EventTypes");
schemaTypeChoiceProperties.setDisplayName(assetFromJSON.getQualifiedName() + "-EventTypes");
schemaTypeChoiceProperties.setTypeName("EventTypeList");
String schemaTypeChoiceGUID = myContext.createSchemaType(assetManagerIsHome, schemaTypeChoiceProperties);
for (LineageEventContentforSample.EventTypeFromJSON eventTypeFromJSON : assetFromJSON.getEventTypes()) {
SchemaTypeProperties schemaTypeProperties = new SchemaTypeProperties();
schemaTypeProperties.setTypeName("EventType");
schemaTypeProperties.setQualifiedName(eventTypeFromJSON.getQualifiedName());
schemaTypeProperties.setDisplayName(eventTypeFromJSON.getTechnicalName());
String schemaTypeGUID = myContext.createSchemaType(assetManagerIsHome, schemaTypeProperties);
myContext.setupSchemaElementRelationship(assetManagerIsHome, schemaTypeGUID, schemaTypeChoiceGUID, "SchemaTypeOption", null, null);
for (LineageEventContentforSample.Attribute attribute : eventTypeFromJSON.getAttributes()) {
createPrimitiveSchemaAttribute(schemaTypeGUID, attribute);
}
}
myContext.setupSchemaTypeParent(assetManagerIsHome, schemaTypeChoiceGUID, assetGUID, "KafkaTopic", null, null);
}
Expected Behavior
The REST call above should works like the following call through the data manager:
GET
{{mds-baseURL}}/servers/{{mds-server}}/open-metadata/access-services/data-manager/users/{{user}}/topics/{{asset-guid}}/event-types?startFrom=0&pageSize=0
This call returns returns us an EventTypeList with all EventTypes associated to the asset, the kafka topic. We expected to get the same or a similiar response on this endpoint
{{mds-baseURL}}/servers/{{mds-server}}/open-metadata/access-services/asset-manager/users/{{user}}/parents/{{asset-type}}/{{asset-guid}}/schema-types/retrieve?forLineage=true&forDuplicateProcessing=true
At best It should be possible to get this response through the Java API (LineageIntegratorConnector).
Steps To Reproduce
- Create a DataAsset with multiple SchemaTypeElements by using SchemaTypeChoice/SchemaType
- Try to get this information by calling the REST API with the following URL:
{{mds-baseURL}}/servers/{{mds-server}}/open-metadata/access-services/asset-manager/users/{{user}}/parents/{{asset-type}}/{{asset-guid}}/schema-types/retrieve?forLineage=true&forDuplicateProcessing=true
Environment
- Egeria: 3.15
- OS:
- Java: 11
- Browser (for UI issues):
- Additional connectors and integration:
Any Further Information?
No response
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 18 (9 by maintainers)
Commits related to this issue
- Fix schema type support (#7692) Signed-off-by: Mandy Chessell <mandy.e.chessell@gmail.com> — committed to mandy-chessell/egeria by mandy-chessell a year ago
I expect that the audit log will show where the problem is and this level of effort to recreate will not be required.
I was planning on write a small FVT to test the method. However, if you want to do it then that is fine by me.