NoSuchMethodError in com.nimbusds.oauth2.sdk.AuthorizationCodeGrant

Issue #118 resolved
Former user created an issue

I m trying to integrate our app using pac4j on client side and openId Connect on server side. After authentication, on call back URL I get this error; here is a stacktrace

java.lang.NoSuchMethodError: com.nimbusds.oauth2.sdk.AuthorizationCodeGrant.<init>(Lcom/nimbusds/oauth2/sdk/AuthorizationCode;Ljava/net/URI;Lcom/nimbusds/oauth2/sdk/id/ClientID;)V at org.pac4j.oidc.client.OidcClient.retrieveUserProfile(OidcClient.java:278) ~[pac4j-oidc-1.7.0-SNAPSHOT.jar:na] at org.pac4j.oidc.client.OidcClient.retrieveUserProfile(OidcClient.java:88) ~[pac4j-oidc-1.7.0-SNAPSHOT.jar:na] at org.pac4j.core.client.BaseClient.getUserProfile(BaseClient.java:241) ~[pac4j-core-1.7.0-SNAPSHOT.jar:na] at org.pac4j.core.client.BaseClient.getUserProfile(BaseClient.java:64) ~[pac4j-core-1.7.0-SNAPSHOT.jar:na] at org.pac4j.play.java.RequiresAuthenticationAction$6.apply(RequiresAuthenticationAction.java:206) ~[play-pac4j_java-1.4.0-SNAPSHOT.jar:na] at org.pac4j.play.java.RequiresAuthenticationAction$6.apply(RequiresAuthenticationAction.java:194) ~[play-pac4j_java-1.4.0-SNAPSHOT.jar:na]

I m using <dependency> <groupId>com.nimbusds</groupId> <artifactId>oauth2-oidc-sdk</artifactId> <version>4.8.2</version> </dependency>

Any idea why this could be happening ? Any insight is appreciated

Comments (2)

  1. Connect2id OSS

    The java.lang.NoSuchMethodError indicates that the AuthorizationCodeGrant constructor is being called with the following arguments:

    AuthorizationCode, URI, ClientID

    In version 4.8.2 of the library, however, there is no such constructor signature. The expected signature is AuthorizationCode, URI.

    It looks like calling code was originally compiled for an older version of the OIDC library which indeed had such a constructor.

    Our suggestion is to downgrade to the expected OIDC SDK version, or update the calling code to the latest 4.8.2 version.

  2. Log in to comment