0

My code:

String token = request.getHeader("authorization"); // I was checked, token have value type Bearer.
MindsphereCredentials credentials = MindsphereCredentials.userTokenBuilder()
            .authorization(token)
            .build();

But my program returns an error at .authorization

ERROR get from

cf logs program_name --recent

2020-06-18T17:09:26.96+0900 [APP/PROC/WEB/0] OUT [CONTAINER] tainerBase.[Catalina].[localhost].[/].[dispatcher] SEVERE Servlet.service() for servlet [dispatcher] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com/auth0/jwt/exceptions/JWTDecodeException] with root cause

I follow this link: mindsphere-sdk-java-v2/sdkreadme_v2

Laurenz Albe
  • 129,316
  • 15
  • 96
  • 132
I Pan
  • 1

1 Answers1

0

A NoClassDefFoundError exception usually suggests that you're missing a dependency.

This is not stated anywhere in the documentation, but it's not enough to just include the MindSphere SDK to your project alone; you also need some additional dependencies to make it work. Try adding the following to your Gradle/Maven build scripts:

org.apache.httpcomponents:httpclient:4.5.12
com.auth0:java-jwt:3.10.2

They're available in Maven Central.

Jeremy Caney
  • 4,585
  • 13
  • 32
  • 54