eclipse-tractusx / tutorial-resources

Apache License 2.0
11 stars 23 forks source link

Error when fetching the catalogue (JerseyExtension NullPointerException) #316

Closed oliverbusch closed 2 months ago

oliverbusch commented 4 months ago

Current Behavior

With the latest mxd version (main 24.04.2024) I get an error message when fetching the catalogue.

fetch-catalog.json

{
    "@context": {
        "edc": "https://w3id.org/edc/v0.0.1/ns/"
    },
    "@type": "CatalogRequest",
    "counterPartyAddress":"http://alice-controlplane:8084/api/v1/dsp",
    "protocol": "dataspace-protocol-http",
    "querySpec": {
        "offset": 0,
        "limit": 50
    }
}

curl -d @fetch-catalog.json -H "x-api-key: password" -H "content-type: application/json" http://localhost:29193/management/v2/catalog/request

Bob Log reports

SEVERE 2024-04-26T10:07:12.635995167 JerseyExtension: Unexpected exception caught
java.lang.NullPointerException

Expected Behavior

In the version from 23.02.2024 the same request works

Steps To Reproduce

Attached the port mapping, the json files, the curl commands and an extract of the log messages. Does anyone have any ideas about the cause of the error?

Port Mapping kubectl port-forward alice-tractusx-connector-controlplane-7855999b86-chf9c 19190:8080 19193:8081 & kubectl port-forward alice-tractusx-connector-dataplane-666855886f-nrdhv 19191:8081 19192:8083 19194:8084 & kubectl port-forward bob-tractusx-connector-controlplane-745ddd86b6-4j92z 29190:8080 29193:8081 & kubectl port-forward bob-tractusx-connector-dataplane-84556d9947-xmcr7 29191:8081 29192:8083 29194:8084 28186:8186 &

Create Asset vi create-asset.json

{
    "@context": {},
    "@id": "112", 
    "properties": {
        "description": "AssetAdministrationShell"
    },
    "dataAddress": {
        "@type": "DataAddress",
        "type": "HttpData",
        "baseUrl": "https://jsonplaceholder.typicode.com",
        "proxyPath": "true",
        "proxyQueryParams": "true",
        "proxyBody": "true",
        "methode": "true"
    }
}

curl -d @create-asset.json -H "x-api-key: password" -H "content-type: application/json" http://localhost:19193/management/v3/assets -s | jq

Create Policy vi create-policy.json

{
  "@context": {
    "@vocab": "https://w3id.org/edc/v0.0.1/ns/",
    "odrl": "http://www.w3.org/ns/odrl/2/"
  },
  "@id": "111",
  "policy": {
    "@type": "odrl:Set",
    "odrl:permission": [],
    "odrl:prohibition": [],
    "odrl:obligation": []
  }
}

curl -d @create-policy.json -H "x-api-key: password" -H "content-type: application/json" http://localhost:19193/management/v2/policydefinitions -s | jq

Create Contract Definition vi create-contract-definition.json

{
    "@context": {},
    "@id": "111",
    "@type": "ContractDefinition",
    "accessPolicyId": "111",
    "contractPolicyId": "111",
    "assetsSelector" : []
    }
}

curl -d @create-contract-definition.json -H "x-api-key: password" -H "content-type: application/json" http://localhost:19193/management/v2/contractdefinitions -s | jq

Fetch Catalog vi fetch-catalog.json

{
    "@context": {
        "edc": "https://w3id.org/edc/v0.0.1/ns/"
    },
    "@type": "CatalogRequest",
    "counterPartyAddress":"http://alice-controlplane:8084/api/v1/dsp",
    "protocol": "dataspace-protocol-http",
    "querySpec": {
        "offset": 0,
        "limit": 50
    }
}

curl -d @fetch-catalog.json -H "x-api-key: password" -H "content-type: application/json" http://localhost:29193/management/v2/catalog/request -s | jq

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 Internal Server Error</title>
</head>
<body><h2>HTTP ERROR 500 Internal Server Error</h2>
<table>
<tr><th>URI:</th><td>/management/v2/catalog/request</td></tr>
<tr><th>STATUS:</th><td>500</td></tr>
<tr><th>MESSAGE:</th><td>Internal Server Error</td></tr>
<tr><th>SERVLET:</th><td>EDC-management</td></tr>
</table>

</body>
</html>

Bob Log reports

SEVERE 2024-04-26T10:07:12.635995167 JerseyExtension: Unexpected exception caught
java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Unknown Source)
        at java.base/java.util.ImmutableCollections$MapN.<init>(Unknown Source)
        at java.base/java.util.Map.of(Unknown Source)
        at org.eclipse.tractusx.edc.identity.mapper.BdrsClientImpl.createMembershipPresentation(BdrsClientImpl.java:153)
        at org.eclipse.tractusx.edc.identity.mapper.BdrsClientImpl.updateCache(BdrsClientImpl.java:121)
        at org.eclipse.tractusx.edc.identity.mapper.BdrsClientImpl.resolve(BdrsClientImpl.java:101)
        at org.eclipse.tractusx.edc.identity.mapper.BdrsClientAudienceMapper.resolve(BdrsClientAudienceMapper.java:39)
        at org.eclipse.edc.protocol.dsp.http.dispatcher.DspHttpRemoteMessageDispatcherImpl.dispatch(DspHttpRemoteMessageDispatcherImpl.java:121)
        at org.eclipse.edc.connector.core.message.RemoteMessageDispatcherRegistryImpl.dispatch(RemoteMessageDispatcherRegistryImpl.java:48)
        at org.eclipse.edc.connector.controlplane.services.catalog.CatalogServiceImpl.requestCatalog(CatalogServiceImpl.java:44)
        at org.eclipse.edc.connector.controlplane.api.management.catalog.CatalogApiController.requestCatalog(CatalogApiController.java:64)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)
        at java.base/java.lang.reflect.Method.invoke(Unknown Source)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:146)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:189)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:159)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:93)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:261)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:265)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:240)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:697)
        at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:394)
        at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:346)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:357)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:311)
        at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:205)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:529)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1381)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1303)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:192)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
        at org.eclipse.jetty.server.Server.handle(Server.java:563)
        at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
        at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
        at java.base/java.lang.Thread.run(Unknown Source)

Does anyone have any ideas about the cause of the error?

oliverbusch commented 4 months ago

After setting up a completely new environment, it works.

Perhaps the error handling could be extended to determine the exact cause of the error. A simple update should not result in a reinstall.

ciprian-nicuta commented 3 months ago

test

hemantxpatel commented 3 months ago

Hi @ieuna, can you have a look?

ieuna commented 3 months ago