I tried to implement Azure into my application in 2 ways
1) Succesful Azure implementation
I tried to implement Azure into Spring as Azure Storage File Datalake https://docs.microsoft.com/en-us/java/api/overview/azure/storage-file-datalake-readme?view=azure-java-stable , with this code it runs succesfully
DataLakeFileSystemClient dataLakeFileSystemClient = new DataLakeFileSystemClientBuilder()
.endpoint("<your-storage-account-url>" + "/" + "myfilesystem" + "?" + "<your-sasToken>")
.buildClient();
2) Unsuccessful Azure implementation
However in order to use Azure with com.azure.identity.clientsecretcredential https://docs.microsoft.com/en-us/java/api/com.azure.identity.clientsecretcredential?view=azure-java-stable
val clientSecretCredential: ClientSecretCredential = ClientSecretCredentialBuilder()
.clientId(clientid)
.clientSecret(clientsecret)
.tenantId(tenantid)
.build()
val builder = DataLakeServiceClientBuilder()
try {
val dataLakeClient = if (httpClient == null) {
builder.credential(clientSecretCredential)
.endpoint(endpoint)
.buildClient()
I use these dependencies
azureCoreHttpNettyVersion = "1.7.0"
azureIdentityVersion = "1.2.0"
azureStorageFileDataLakeVersion = "12.3.0"
implementation("com.azure:azure-storage-file-datalake:${azureStorageFileDataLakeVersion}")
implementation("com.azure:azure-identity:${azureIdentityVersion}")
implementation("com.azure:azure-core-http-netty:${azureCoreHttpNettyVersion}")
I got this Error
2020-12-15 12:03:01.727 ERROR 6416 --- [nPool-worker-19] c.azure.identity.ClientSecretCredential : Azure Identity => ERROR in getToken() call for scopes [https://storage.azure.com/.default]: com/nimbusds/oauth2/sdk/http/CommonContentTypes
2020-12-15 12:03:01.728 ERROR 6416 --- [nPool-worker-19] c.a.core.credential.SimpleTokenCache : Failed to acquire a new access token.
Exception in thread "main" java.lang.NoClassDefFoundError: com/nimbusds/oauth2/sdk/http/CommonContentTypes
at com.microsoft.aad.msal4j.TokenRequestExecutor.createOauthHttpRequest(TokenRequestExecutor.java:46)
at com.microsoft.aad.msal4j.TokenRequestExecutor.executeTokenRequest(TokenRequestExecutor.java:36)
at com.microsoft.aad.msal4j.AbstractClientApplicationBase.acquireTokenCommon(AbstractClientApplicationBase.java:119)
at com.microsoft.aad.msal4j.AcquireTokenByAuthorizationGrantSupplier.execute(AcquireTokenByAuthorizationGrantSupplier.java:63)
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:59)
at com.microsoft.aad.msal4j.AuthenticationResultSupplier.get(AuthenticationResultSupplier.java:17)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run$$$capture(CompletableFuture.java:1700)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at java.base/java.util.concurrent.ForkJoinTask.doExec$$$capture(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.ClassNotFoundException: com.nimbusds.oauth2.sdk.http.CommonContentTypes
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 15 more
### If I run the method 2 as a simple function it works correctly, If I run it using spring I got the error above.
Affects: \
Comment From: snicoll
@nandorrb this is the spring framework issue tracker. Please raise that issue against the Azure Java SDK project.