azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

[QUERY] NoSuchMethodError for Azure Management Java SDK

Open ihsanhaikalz opened this issue 2 years ago • 2 comments

I am really new with Azure Java SDK and I would like to run Azure Management Java SDK following https://docs.microsoft.com/en-us/java/api/overview/azure/resourcemanager-apimanagement-readme?view=azure-java-preview and https://github.com/Azure/azure-sdk-for-java/blob/azure-resourcemanager-apimanagement_1.0.0-beta.3/sdk/resourcemanager/docs/AUTH.md with the code as follows:

    AzureProfile profile = new AzureProfile(tenantId, subscriptionId, AzureEnvironment.AZURE);
    final ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
            .clientId(clientId)
            .clientSecret(clientSecret)
            .tenantId(tenantId)
            .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())

            .build();
    ApiManagementManager manager = ApiManagementManager.authenticate(clientSecretCredential, profile);

However, when I run the code it would return this error on the ApiManagementManager:

    java.lang.NoSuchMethodError: 'void com.azure.core.util.serializer.JacksonAdapter.<init>(java.util.function.BiConsumer)'
    	at com.azure.core.management.implementation.serializer.AzureJacksonAdapter.<init>(AzureJacksonAdapter.java:17)
    	at com.azure.core.management.serializer.SerializerFactory.createDefaultManagementSerializerAdapter(SerializerFactory.java:26)
    	at com.azure.resourcemanager.apimanagement.implementation.ApiManagementClientBuilder.buildClient(ApiManagementClientBuilder.java:142)
    	at com.azure.resourcemanager.apimanagement.ApiManagementManager.<init>(ApiManagementManager.java:350)
    	at com.azure.resourcemanager.apimanagement.ApiManagementManager.<init>(ApiManagementManager.java:186)
    	at com.azure.resourcemanager.apimanagement.ApiManagementManager$Configurable.authenticate(ApiManagementManager.java:525)
    	at com.azure.resourcemanager.apimanagement.ApiManagementManager.authenticate(ApiManagementManager.java:363)

Any idea why?

ihsanhaikalz avatar Aug 08 '22 17:08 ihsanhaikalz

Hi @ihsanhaikalz thank you for reaching out to us via this GitHub issue. Someone from the control plane SDK team will follow up with you shortly.

You can also refer to https://docs.microsoft.com/en-us/azure/developer/java/sdk/troubleshooting-dependency-version-conflict and https://devblogs.microsoft.com/azure-sdk/dependency-management-for-java/ for guidance on how to resolve dependency conflicts in the local client side application.

joshfree avatar Aug 09 '22 19:08 joshfree

@ihsanhaikalz

Please see https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/resourcemanager#dependency-management

Your project likely having conflict version of azure-core. Please make it the latest version.

weidongxu-microsoft avatar Aug 10 '22 01:08 weidongxu-microsoft

Hi @ihsanhaikalz. 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.

ghost avatar Aug 19 '22 08:08 ghost

Hi @ihsanhaikalz, 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.

ghost avatar Aug 26 '22 16:08 ghost