commercetools / commercetools-sdk-java-v2

The e-commerce SDK from commercetools for Java.
https://commercetools.github.io/commercetools-sdk-java-v2/javadoc/index.html
Apache License 2.0
35 stars 15 forks source link

java.util.concurrent.CompletionException: java.lang.NoSuchMethodError: okhttp3.RequestBody.create([BLokhttp3/MediaType;)Lokhttp3/RequestBody; #178

Closed sanooj6 closed 3 years ago

sanooj6 commented 3 years ago

Describe the bug I am trying to make request using the Java SDK v2. any requests that I send throws exception

To Reproduce just make any request

*Stack information (please complete the following information):**

jenschude commented 3 years ago

The issue comes from the fact that spring boot has a dependency against OkHttp 3.x, but the commercetools-http-client package requires OkHttp 4.x

It should fixed by using commercetools-okhttp-client3 instead.

sanooj6 commented 3 years ago

Now I'm getting the following error. My CLient API scop is : manage_project


io.vrap.rmf.base.client.oauth2.AuthException: detailMessage: Method Not Allowed
http response: io.vrap.rmf.base.client.ApiHttpResponse@5c9fd01c[statusCode=405,headers=[{key=access-control-allow-headers, value=Accept, Authorization, Content-Type, Origin, User-Agent, X-Correlation-ID}, {key=access-control-allow-methods, value=GET, POST, DELETE, OPTIONS}, {key=access-control-allow-origin, value=*}, {key=access-control-max-age, value=299}, {key=allow, value=GET}, {key=alt-svc, value=clear}, {key=content-length, value=0}, {key=date, value=Thu, 12 Aug 2021 09:43:58 GMT}, {key=server, value=istio-envoy}, {key=server-timing, value=auth;dur=0}, {key=via, value=1.1 google}, {key=x-correlation-id, value=auth-3d648e5a-6b0c-4f45-8cb4-d15357ddb548}, {key=x-envoy-upstream-service-time, value=0}],textInterpretedBody=]
SDK: 5.0.0
Java: 1.8.0_301
jenschude commented 3 years ago

Can you please provide your auth URL?

We have the ServiceRegion helper class which correctly sets up the Auth URL to be like this: https://auth.europe-west1.gcp.commercetools.com/oauth/token

Usage e.g.: ServiceRegion.GCP_EUROPE_WEST1.getOAuthTokenUrl()

jenschude commented 3 years ago

Improvements to hint typical starter errors have been released