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] no matching server end point for Asset manager omas create schema attribute #7140

Closed
1 task done
davidradl opened this issue Nov 27, 2022 · 6 comments
Closed
1 task done
Labels
bug Something isn't working triage New bug/issue which needs checking & assigning

Comments

@davidradl
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

In SchemaExchange Resource. the spring end point is defined as
@PostMapping(path = "/schema-elements/{schemaElementGUID}/schema-attribute")

The client is SchemaExchangeClientBase in createSchemaAttribute uses
final String urlTemplate = serverPlatformURLRoot + urlTemplatePrefix + "/schema-elements/{2}/schema-attributes?assetManagerIsHome={3}&forLineage={4}&forDuplicateProcessing={5}";

All the client and server calls should use schema-attributes not schema-attribute

Expected Behavior

Expect the client calls to match the server endpoint names

Steps To Reproduce

issue createschemaelement . \This would found while developing the lineage event sample

Environment

- Egeria:
- OS:
- Java:
- Browser (for UI issues):
- Additional connectors and integration:

Any Further Information?

No response

@davidradl davidradl added bug Something isn't working triage New bug/issue which needs checking & assigning labels Nov 27, 2022
@davidradl
Copy link
Member Author

After fixing the endpoint, I see another error
Screenshot 2022-11-28 at 13 38 52

The problem is that SchemaElementHandler in addEmbeddedTypes - line 258. The code does

        if (repositoryHelper.isTypeOf(serviceName, schemaTypeBuilder.getTypeName(), OpenMetadataAPIMapper.EXTERNAL_SCHEMA_TYPE_TYPE_NAME))
        {

schemaTypeBuilder is null, so we null pointer with
nformation: log record id c942f9e6-2362-4c42-b531-c6cf868008e5 java.lang.NullPointerException returned message of null and stacktrace of
java.lang.NullPointerException
at org.odpi.openmetadata.commonservices.generichandlers.SchemaElementHandler.addEmbeddedTypes(SchemaElementHandler.java:258)
at org.odpi.openmetadata.commonservices.generichandlers.SchemaAttributeHandler.createNestedSchemaAttribute(SchemaAttributeHandler.java:642)
at org.odpi.openmetadata.commonservices.generichandlers.SchemaAttributeHandler.createNestedSchemaAttribute(SchemaAttributeHandler.java:306)
at org.odpi.openmetadata.accessservices.assetmanager.handlers.SchemaExchangeHandler.createSchemaAttribute(SchemaExchangeHandler.java:1216)
at org.odpi.openmetadata.accessservices.assetmanager.server.SchemaExchangeRESTServices.createSchemaAttribute(SchemaExchangeRESTServices.java:811)
at org.odpi.openmetadata.accessservices.assetmanager.server.spring.SchemaExchangeResource.createSchemaAttribute(SchemaExchangeResource.java:423)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:150)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:808)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1071)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:964)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:696)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:779)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.odpi.openmetadata.http.HttpRequestHeadersFilter.doFilter(HttpRequestHeadersFilter.java:49)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:117)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilte
....

@davidradl
Copy link
Member Author

The reason that schemaTypeBuilder is null is because line 1318 in SchemaExchangeHandler, schemaAttributeProperties.getSchemaType() is null so it does not think there is a schemaType to setup

@davidradl
Copy link
Member Author

If I supply the SchemaTypeProperties in the schemaAttributeProperties I supply then schemaAttributeProperties.getSchemaType() is not null and it does not null pointer. @mandy-chessell this seems unintuitive - I would have expected it to have been able to work out the schema type from the schematype guid.

@davidradl
Copy link
Member Author

I was expecting the createSchemaAttribute to create the schema to attribute relationship. This is not occurring.

@mandy-chessell
Copy link
Contributor

There are two "schema types" associated with the schema attribute and I am having difficulty in following your notes as it is not clear which you mean.

The schemaElementGUID is the parent GUID. This should be linked to the new schema attribute with either the AttributeForSchema or the NestedSchemaAttribute relationship.

The second schema type is the one that describes the type of the attribute. This is the one that is specified in the SchemaTypeProperties embedded in the SchemaAttributesProperties. The contents are stored in the TypeEmbeddedAttribute classification. The schema type of the schema attribute does not have to be (in fact is unlikely to be) the same type as the parent schema GUID so it is not possible to derive one from the other.

Asset Manager OMAS does not support the old style of schema construction (it can read it but not create/edit it. Therefore is never creates the SchemaAttributeType (there is not such relationship as SchemaToAttribute so I am guessing this is what you mean).

The NPE is not good and the client should validate that the schemaTypeProperties are not null at the top of the createSchemaTypeAttributes() method.

@davidradl
Copy link
Member Author

Hi Mandy, that really helps. I was using the wrong schematype in the attribute properties. I will change the to the appropriate schema type in the integration connector code. There currently is no AttributeForSchema or the NestedSchemaAttribute relationship being created for me. So the EventType is not related to the EventSchemaAttribute in any way. I am continuing to investigate.

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

2 participants