Azure / azure-sdk-for-java

This repository is for active development of the Azure SDK for Java. For consumers of the SDK we recommend visiting our public developer docs at https://docs.microsoft.com/java/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-java.
MIT License
2.32k stars 1.97k forks source link

java.lang.NoClassDefFoundError: Could not initialize class com.azure.identity.implementation.IdentityClient #39120

Closed Arefaat18 closed 6 months ago

Arefaat18 commented 6 months ago

I am getting this error while executing this line of code

final ClientSecretCredential credential = new ClientSecretCredentialBuilder()
                .clientId(CLIENT_ID).tenantId(TENANT_ID).clientSecret(CLIENT_SECRET)
                .build();

In debugging the error it works correctly until this function in IdentityClientBuilder class

public IdentityClient build() {
        return new IdentityClient(this.tenantId, this.clientId, this.clientSecret, this.certificatePath, this.clientAssertionPath, this.resourceId, this.clientAssertionSupplier, this.certificate, this.certificatePassword, this.sharedTokenCacheCred, this.clientAssertionTimeout, this.identityClientOptions);
    }

where it throws this error

java.lang.NoClassDefFoundError: Could not initialize class com.azure.identity.implementation.IdentityClient

I am working in a SAP Commerce Cloud 2211 project with azure-identity-1.11.2.jar , azure-core-1.46.0.jar Due to a bug in SAP Commerce I can't download the jars using Maven, so I am working with the downloaded jars.

Thank you for your help.

joshfree commented 6 months ago

Hi @Arefaat18 it sounds like there's a dependency conflict in the application. Here's our troubleshooting guide on how to resolve this: https://learn.microsoft.com/en-us/azure/developer/java/sdk/troubleshooting-dependency-version-conflict

github-actions[bot] commented 6 months ago

Hi @Arefaat18. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

github-actions[bot] commented 6 months ago

Hi @Arefaat18, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.