risingTide
risingTide

Reputation: 1896

ClassNotFoundException: com.auth0.jwt.exceptions.JWTCreationException with DocuSignApi Java SDK

I'm trying to implement some basic functionality with the newest DocuSignApi for Java (version 2.6.2). I'm currently just trying to get the JWT Authorization Flow working. Here's the code:

ApiClient apiClient = new ApiClient();

this.apiClient.configureJWTAuthorizationFlow(this.adminProperties.getRsaPublicKey(), this.adminProperties
            .getRsaPrivateKey(), this.adminProperties.getoAuthBaseUrl(), this.adminProperties.getIntegratorKey(),
            this.adminProperties.getImpersonatedUserGuid(), TOKEN_EXPIRATION_IN_SECONDS);

On the `ApiClient.configureJWTAuthorizationFlow(...) call above I'm receiving the following runtime error:

Caused by: java.lang.ClassNotFoundException: com.auth0.jwt.exceptions.JWTCreationException
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

I do not receive any compilation errors, just to be clear.

I have added this to my project pom as indicated from the DocuSignApi Java Wiki:

  <dependency>
    <groupId>com.docusign</groupId>
    <artifactId>docusign-esign-java</artifactId>
    <version>2.6.2</version>
  </dependency>

Now I'm also using a Maven archetype that is pulling in a ton of other jars that are used with all of my company's projects and are needed for other functionality in my application. I can see that my effective pom is pulling in this version of java-jwt & spring-security-jwt:

  <dependency>
    <groupId>com.auth0</groupId>
    <artifactId>java-jwt</artifactId>
    <version>2.2.0</version>
  </dependency>
  <dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-jwt</artifactId>
    <version>1.0.8.RELEASE</version>
  </dependency>

I also noticed that one of the dependencies listed on the DocuSignApi Java Wiki is as such:

org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2

I suspect that my error may have something to do with a version conflict between the JWT 2.2.0 in my archetype and the required 1.0.2 version from DocuSign.

My questions are

  1. Is my error indeed caused by a version conflict with the JWT jar?
  2. If so, what's the best way to remedy this problem? Can the DocuSignApi work with a newer version of JWT like I have?

Thank you for your time!

Upvotes: 2

Views: 2647

Answers (1)

risingTide
risingTide

Reputation: 1896

The issue here ended up being conflicting versions of the java-jwt jar. My project is using the 2.2.0 version, but the dependency needed for the 2.6.2 version of the Java DocuSign API is 3.2.0.

The

org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.2

dependency I listed above was a misnomer...that wasn't the conflicting jar.

Since I do not have the ability to upgrade to the java-jwt 3.2.0 jar at this time I am forced to downgrade my Java DocuSign API to 2.2.1 where the dependency on the java-jwt is non-existent.

Hopefully someone else can benefit from the rather simple mistake I made here.

Upvotes: 1

Related Questions