Share via

java.lang.NoSuchMethodError: 'java.lang.String com.azure.core.credential.TokenRequestContext.getTenantId()

sunil.bansal 1 Reputation point
2021-11-16T04:54:21.237+00:00

I've created a SparkBatchJob in Azure Synapse and trying to authenticate the SparkBatchClient with hardcoded SP credentials through ClientSecretCredential but getting the below error:

Exception in thread "main" java.lang.NoSuchMethodError: 'java.lang.String com.azure.core.credential.TokenRequestContext.getTenantId()'
at com.azure.identity.implementation.util.IdentityUtil.resolveTenantId(IdentityUtil.java:26)
at com.azure.identity.implementation.IdentityClient.lambda$authenticateWithConfidentialClientCache$29(IdentityClient.java:771)
at reactor.core.publisher.Mono.lambda$fromFuture$2(Mono.java:650)
at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816)
at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.signalCached(MonoCacheTime.java:337)

I've also tried with setting the environment variable and used DefaultAzureCredentialBuilder to generate the token as well but it also didn't work.

To generate the SP credentials, I've used 'az ad sp create-for-rbac -n <application-name> --skip-assignment' command.

I'm referring the below document to create this sample program:

https://learn.microsoft.com/en-us/java/api/overview/azure/analytics-synapse-spark-readme?view=azure-java-preview

Azure Synapse Analytics
Azure Synapse Analytics

An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.

0 comments No comments

1 answer

Sort by: Most helpful
  1. HimanshuSinha 19,637 Reputation points Microsoft Employee Moderator
    2021-11-16T23:10:31.21+00:00

    Hello @sunil.bansal ,
    Thanks for the ask and using Microsoft Q&A platform .
    Reading the exception i do not think that its related to service prinicipal and it is not getting some methods .
    Can you please try to fork the below git repo and see if that helps ? I see that recently it was updated .

    https://github.com/Azure/azure-sdk-for-java/tree/azure-analytics-synapse-spark_1.0.0-beta.5/sdk/synapse/azure-analytics-synapse-spark

    Please do let me know how it goes .
    Thanks
    Himanshu

    -------------------------------------------------------------------------------------------------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.