Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ClassCastException at getSchemaTypeForElement (Asset-Manager) #7692

Closed
dbruns91 opened this issue May 24, 2023 · 18 comments
Closed

[BUG] ClassCastException at getSchemaTypeForElement (Asset-Manager) #7692

dbruns91 opened this issue May 24, 2023 · 18 comments
Assignees
Labels
bug Something isn't working triage New bug/issue which needs checking & assigning

Comments

@dbruns91
Copy link

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

  1. Create a DataAsset with multiple SchemaTypeElements by using SchemaTypeChoice/SchemaType
  2. 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

@dbruns91 dbruns91 added bug Something isn't working triage New bug/issue which needs checking & assigning labels May 24, 2023
@juergenhemelt
Copy link

@mandy-chessell Can you have a look at this?

@mandy-chessell mandy-chessell self-assigned this May 31, 2023
@mandy-chessell
Copy link
Contributor

I will add it to my list and look at it when I get some time.

@davidradl
Copy link
Member

davidradl commented Jun 5, 2023

@dbruns91 and I had a talk this morning about this. The error shows SchemaTypeElement cannot be cast to class org.odpi.openmetadata.accessservices.assetmanager.properties.SchemaTypeProperties I am guessing that in the choice case it finds a SchemaType (the EventType); in this case we have asset -> schematype -> schematype -> schemaattributes. Prior to this code we would have asset -> schematype -> schemattributes. I guess there is logic in the retrieve that not handling the schematype -> schematype case.

to debug we suggested:

  • single step the client side code to check after each rest call that Rex UI shows the entities as expected. Daniel can test against the exiting Open shift OMAG platforms.
  • Daniel said he will create a draft pr with the connector code he has added. So we can attempt to recreate.
  • Daniel agreed he would set up locally so it he source debug and add a new junit / app case to multiple top level schemas that will drive the code. At this stage he could check the 'create' path and the 'get' path are as expected. A breakpoint on the class cast exception and seeing the stack would be interesting.

@mandy-chessell

@mandy-chessell
Copy link
Contributor

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.

@dbruns91
Copy link
Author

dbruns91 commented Jun 7, 2023

@davidradl here is the draft pr for the connector: odpi/egeria-connector-integration-lineage-event-driven-sample#66

I will use the next days to setup a local egeria instance.

@mandy-chessell
Copy link
Contributor

I have switch the owner to @davidradl since you have taken it over from me.

@mandy-chessell
Copy link
Contributor

I have added a PR to 4.2-SNAPSHOT. It fixes multiple issues in Asset Manager's schema function which is also surfaced through the Lineage Integrator OMIS. It also involved restructuring the schema element beans so they closer match the structure used in Data Manager OMAS. Therefore, your lineage connector is likely to need some code changes to work with the latest level of Egeria. However, it may then work :)

@dbruns91
Copy link
Author

dbruns91 commented Jun 20, 2023

@mandy-chessell Thank you for the PR. That sounds great. I will test it asap so we can close this issue.

@dbruns91
Copy link
Author

@mandy-chessell I updated the connector to 4.2-SNAPSHOT, sent an typical metadata event to the topic and got the following error message:

Thu Jun 22 14:52:25 GMT 2023 cocoMDS1 Exception LINEAGE_SAMPLE-INTEGRATION-CONNECTOR-0002 Exception org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException occurred in Integration connector LineageIntegrator - the error message was OMAG-REPOSITORY-HANDLER-404-007 The Referenceable entity with unique identifier null is not found for method setupSchemaElementRelationship of access service Asset Manager OMAS in open metadata server mds1, error message was: OMRS-REPOSITORY-404-002 The entity identified with guid null passed on the getEntityDetail call is not known to the open metadata repository Enterprise.

The connector code looks like this

    private void ensureSchemaIsCatalogued(LineageEventContentforSample.AssetFromJSON assetFromJSON, String assetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException {
        SchemaTypeElement schemaTypeForElement = myContext.getSchemaTypeForElement(assetGUID, assetFromJSON.getTypeName(), null);
        if (schemaTypeForElement != null) {
            myContext.removeSchemaType(schemaTypeForElement.getElementHeader().getGUID(), null);
        }
        SchemaTypeProperties typeProperties = new SchemaTypeProperties();
        typeProperties.setQualifiedName(assetFromJSON.getQualifiedName() + "-EventTypes");
        typeProperties.setDisplayName(assetFromJSON.getQualifiedName() + "-EventTypes");
        typeProperties.setTypeName("EventTypeList");
        String schemaTypeChoiceGUID = myContext.createSchemaType(assetManagerIsHome, typeProperties);
        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);
    }

Do you see a problem? The creation logic above do not throw an error in 3.15.

@dbruns91
Copy link
Author

I tested (nearly) the same code in 4.1 - that works fine. It ended with

Fri Jun 23 07:56:48 UTC 2023 cocoMDS1 Information LINEAGE_SAMPLE-INTEGRATION-CONNECTOR-0007 Event successfully processed

without an error.

@mandy-chessell
Copy link
Contributor

I think that the GUIDs are around the wrong way - the schemaTypeChoiceGUID should be endOne and the eventType GUID is endTwo. However that does not explain where there is a null GUID being passed through.

Another thought is that there is a new method called createAnchoredSchemaType() which is designed to anchor the schema type entities to the asset. (So anchorGUID=assetGUID). This means that if the asset is deleted, the schema elements are deleted too.

Creating schemaAttributes always anchors them to the same anchor as the element that the new schema attribute is connected to. With schema types they can be created/used independently of the asset or anchored - this is why there are two methods for creatign schema types.

@dbruns91
Copy link
Author

dbruns91 commented Jun 27, 2023

According to your tips I changed it like this:

    private void ensureSchemaIsCatalogued(LineageEventContentforSample.AssetFromJSON assetFromJSON, String assetGUID) throws InvalidParameterException, PropertyServerException, UserNotAuthorizedException {
        SchemaTypeElement schemaTypeForElement = myContext.getSchemaTypeForElement(assetGUID, assetFromJSON.getTypeName(), null);
        if (schemaTypeForElement != null) {
            myContext.removeSchemaType(schemaTypeForElement.getElementHeader().getGUID(), null);
        }
        SchemaTypeProperties typeProperties = new SchemaTypeProperties();
        typeProperties.setQualifiedName(assetFromJSON.getQualifiedName() + "-EventTypes");
        typeProperties.setDisplayName(assetFromJSON.getQualifiedName() + "-EventTypes");
        typeProperties.setTypeName("EventTypeList");
        String schemaTypeChoiceGUID = myContext.createSchemaType(assetManagerIsHome, typeProperties);
        for (LineageEventContentforSample.EventTypeFromJSON eventTypeFromJSON : assetFromJSON.getEventTypes()) {
            SchemaTypeProperties schemaTypeProperties = new SchemaTypeProperties();
            schemaTypeProperties.setTypeName("EventType");
            schemaTypeProperties.setQualifiedName(eventTypeFromJSON.getQualifiedName());
            schemaTypeProperties.setDisplayName(eventTypeFromJSON.getTechnicalName());
            String schemaTypeGUID = myContext.createAnchoredSchemaType(assetManagerIsHome, assetGUID, null, schemaTypeProperties);
            myContext.setupSchemaElementRelationship(assetManagerIsHome, schemaTypeGUID, schemaTypeChoiceGUID, "SchemaTypeOption", null, null);
            for (LineageEventContentforSample.Attribute attribute : eventTypeFromJSON.getAttributes()) {
                createPrimitiveSchemaAttribute(schemaTypeGUID, attribute);
            }
        }
        myContext.setupSchemaTypeParent(assetManagerIsHome, assetGUID, schemaTypeChoiceGUID, "KafkaTopic", null, null);
    }

It throws the same exception.

I am still wondering that nearly the same code works fine in Egeria 4.1 . Does Egeria 4.2 have such big changes?

@mandy-chessell
Copy link
Contributor

I can't see much change - the code still seems to be using createSchemaType() rather than createAnchoredSchemaType() and the relationshipGUIDs are the wrong way around. Is this the new code?

The main changes between 4.1 and 4.2 are in the retrieval of schema types. I did also fix a couple of bugs (such as the schem type GUID being reversed) and I added createAnchoredSchemaType.

It would be a great help to see the audit log entries for the failing call from the metadata access server. This will show me the stack trace of where it is failing.

Also you can also check in your code that neither schemaTypeGUID nore schemaTypeChoiceGUID is null. They should not be - but it may help to identify the problem

@dbruns91
Copy link
Author

dbruns91 commented Jun 28, 2023

I had not changed createAnchoredSchemaType(..) everywhere, maybe this was wrong. In the code above the change is in the for-loop. Now I changed it everywhere and flipped schemaTypeGUID and schemaTypeChoiceGUID (sorry I had missed that):

myContext.setupSchemaElementRelationship(assetManagerIsHome, schemaTypeChoiceGUID, schemaTypeGUID, "SchemaTypeOption", null, null);

The egeria base/metadate-server error logs like this:

Wed Jun 28 08:41:08 GMT 2023 mds1 Exception OMAG-REPOSITORY-HANDLER-0003 An unexpected error org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException was returned to validateEntityGUID by the metadata server during setupSchemaTypeParent request for open metadata access service Asset Manager OMAS on server mds1; message was OMAG-REPOSITORY-HANDLER-404-001 The validateEntityGUID method has retrieved a object for unique identifier (guid) 62e02311-63a7-49f0-8a69-db4f991e1c2e which is of type EventTypeList rather than type KafkaTopic on behalf of method setupSchemaTypeParent
Wed Jun 28 08:41:08 GMT 2023 mds1 Exception OMAG-REPOSITORY-HANDLER-0003 Supplementary information: log record id e01f1a7b-a007-456f-8a53-35a0e023b570 org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException returned message of OMAG-REPOSITORY-HANDLER-404-001 The validateEntityGUID method has retrieved a object for unique identifier (guid) 62e02311-63a7-49f0-8a69-db4f991e1c2e which is of type EventTypeList rather than type KafkaTopic on behalf of method setupSchemaTypeParent and stacktrace of 
InvalidParameterException{parameterName='guid', reportedHTTPCode=404, reportingClassName='org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryErrorHandler', reportingActionDescription='setupSchemaTypeParent', reportedErrorMessage='OMAG-REPOSITORY-HANDLER-404-001 The validateEntityGUID method has retrieved a object for unique identifier (guid) 62e02311-63a7-49f0-8a69-db4f991e1c2e which is of type EventTypeList rather than type KafkaTopic on behalf of method setupSchemaTypeParent', reportedErrorMessageId='OMAG-REPOSITORY-HANDLER-404-001', reportedErrorMessageParameters=[validateEntityGUID, 62e02311-63a7-49f0-8a69-db4f991e1c2e, EventTypeList, KafkaTopic, setupSchemaTypeParent], reportedSystemAction='The service is not able to return the requested object.', reportedUserAction='Check that the unique identifier is correct and the metadata server(s) supporting the service is running.', reportedCaughtException=null, reportedCaughtExceptionClassName='null', relatedProperties=null}
	at org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryErrorHandler.handleWrongTypeForGUIDException(RepositoryErrorHandler.java:547)
	at org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryErrorHandler.validateInstanceType(RepositoryErrorHandler.java:342)
	at org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryHandler.validateEntityGUID(RepositoryHandler.java:139)
	at org.odpi.openmetadata.commonservices.repositoryhandler.RepositoryHandler.getEntityByGUID(RepositoryHandler.java:3135)
	at org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericHandler.linkElementToElement(OpenMetadataAPIGenericHandler.java:12875)
	at org.odpi.openmetadata.commonservices.generichandlers.OpenMetadataAPIGenericHandler.linkElementToElement(OpenMetadataAPIGenericHandler.java:12710)
	at org.odpi.openmetadata.accessservices.assetmanager.handlers.SchemaExchangeHandler.setupSchemaTypeParent(SchemaExchangeHandler.java:546)
	at org.odpi.openmetadata.accessservices.assetmanager.server.SchemaExchangeRESTServices.setupSchemaTypeParent(SchemaExchangeRESTServices.java:292)
	at org.odpi.openmetadata.accessservices.assetmanager.server.spring.SchemaExchangeResource.setupSchemaTypeParent(SchemaExchangeResource.java:166)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:207)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:152)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:118)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:884)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1081)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:974)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1011)
	at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:590)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:885)
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:205)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.odpi.openmetadata.http.HttpRequestHeadersFilter.doFilter(HttpRequestHeadersFilter.java:62)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:109)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:174)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:149)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:166)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:738)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:390)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:894)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.base/java.lang.Thread.run(Thread.java:833)

@mandy-chessell
Copy link
Contributor

So it seems, with your changes, that the error has shifted. The exception shows that the error is now in the call setupSchemaTypeParent().

OMAG-REPOSITORY-HANDLER-0003 An unexpected error org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException was returned to validateEntityGUID by the metadata server during setupSchemaTypeParent request for open metadata access service Asset Manager OMAS on server mds1; message was OMAG-REPOSITORY-HANDLER-404-001 The validateEntityGUID method has retrieved a object for unique identifier (guid) 62e02311-63a7-49f0-8a69-db4f991e1c2e which is of type EventTypeList rather than type KafkaTopic on behalf of method setupSchemaTypeParent

This is the method signature:

    public void setupSchemaTypeParent(boolean                assetManagerIsHome,
                                      String                 schemaTypeGUID,
                                      String                 parentElementGUID,
                                      String                 parentElementTypeName,
                                      RelationshipProperties properties,
                                      Date                   effectiveTime) throws InvalidParameterException,
                                                                                   UserNotAuthorizedException,
                                                                                   PropertyServerException

The schemaTypeGUID is the second parameter and the asset GUID (KafkaTopic's GUID in this case) is the third parameter. So if the call is changed from

myContext.setupSchemaTypeParent(assetManagerIsHome, assetGUID, schemaTypeChoiceGUID, "KafkaTopic", null, null);

to

myContext.setupSchemaTypeParent(assetManagerIsHome, schemaTypeChoiceGUID, assetGUID, "KafkaTopic", null, null);

it may work.

This change in parameter ordering may be one of the bugs I fixed - I know I fixed one of the relationship methods because the server-side had incorrectly flipped the relationship end guids. That could explain why it worked before even though it was incorrectly coded.

@dbruns91
Copy link
Author

It worked! Thank you, Mandy :-) It makes sense to change it that way, it is just hard to understand when you are not so into Egeria ;-)

Last question to this topic: What is the best way to get a list of "EventType" which is associated to "-EventTypes"?

In our MockLineageIntegratorContext I created an extra method for this:

SchemaTypeElement schemaTypeElement = mockContext.getSchemaTypeForElement(outputDataAssetElement.getElementHeader().getGUID(), "KafkaTopic", new Date());
List<SchemaTypeElement> schemaTypeElementList = ((MockLineageIntegratorContext) mockContext).getSchemaTypesForElement(schemaTypeElement.getElementHeader().getGUID());

Maybe I am understand something wrong and/or this is not the right way to do it ... or there is a method missing.

@mandy-chessell
Copy link
Contributor

When you retrieve the schemaType for the asset, you are returned the schemaTypeElement for the SchemaTypeChoice entity. Inside that element is the list of option schema types. These are the event types.

public class SchemaTypeElement implements MetadataElement
{
    private ElementHeader                   elementHeader        = null;
    private List<MetadataCorrelationHeader> correlationHeaders   = null;
    private SchemaTypeProperties            schemaTypeProperties = null;

    /*
     * For complex schema types such as StructSchemaType
     */
    private int                                          attributeCount       = 0;

    /*
     * For Map Schema Types
     */
    private SchemaTypeElement                            mapFromElement = null;
    private SchemaTypeElement                            mapToElement   = null;

    /*
     * For External Schema Types
     */
    private SchemaTypeElement                            externalSchemaType = null;

    /*
     * Schema options for SchemaTypeChoice
     */
    private List<SchemaTypeElement>                      schemaOptions = null;

    /*
     * Used when a value, or set of values associated with the schema are derived rather than stored.
     */
    private String                                       formula     = null;
    private String                                       formulaType = null;
    private List<DerivedSchemaTypeQueryTargetProperties> queries     = null;

@dbruns91
Copy link
Author

Great! Thank you for the explanation! My local tests looks good. I will close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage New bug/issue which needs checking & assigning
Projects
None yet
Development

No branches or pull requests

4 participants