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.34k stars 1.98k forks source link

linkedstorageaccounts.get produces stack trace on success message concatenation #36598

Open KinderBoeing12 opened 1 year ago

KinderBoeing12 commented 1 year ago

Describe the bug I’ve run into an error message when trying to pull information from the LinkedStorage accounts objects using the Azure Java SDK (with java 1.8). This is with respect to trying to use Log Analytics API’s when trying to pull stats for our Azure Batch run. This happens when I call the linkedStorageAccounts.get method (see print screen 2). I have looked for a solution online and found none and I’ve looked through the code and it may be a bug (see print screen 1).

Exception or Stack Trace 19:19:40.162 [ForkJoinPool.commonPool-worker-1] DEBUG com.microsoft.aad.msal4j.ConfidentialClientApplication - [Correlation ID: 88f134fb-5bf4-414f-86e3-7e44a87dff79] Access Token was returned 19:19:40.166 [ForkJoinPool.commonPool-worker-1] ERROR reactor.core.publisher.Operators - Operator called default onErrorDropped java.lang.NoSuchMethodError: com.azure.core.util.CoreUtils.stringJoin(Ljava/lang/String;Ljava/util/List;)Ljava/lang/String; at com.azure.identity.implementation.util.LoggingUtil.lambda$logTokenSuccess$0(LoggingUtil.java:30) at com.azure.core.util.logging.ClientLogger.performDeferredLogging(ClientLogger.java:530) at com.azure.core.util.logging.ClientLogger.log(ClientLogger.java:150) at com.azure.core.util.logging.ClientLogger.log(ClientLogger.java:125) at com.azure.identity.implementation.util.LoggingUtil.logTokenSuccess(LoggingUtil.java:28) at com.azure.identity.ClientSecretCredential.lambda$getToken$2(ClientSecretCredential.java:120) at reactor.core.publisher.FluxPeekFuseable$PeekConditionalSubscriber.onNext(FluxPeekFuseable.java:840) at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:74) at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:129) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:249) at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) at reactor.core.publisher.MonoCompletionStage.lambda$subscribe$0(MonoCompletionStage.java:83) at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774) at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:750) at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488) at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1609) at java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1596) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1067) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1703) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:172)

To Reproduce See code snippets

Code Snippet LogAnalyticsManager manager = LogAnalyticsManager .authenticate(credential, profile);

    LinkedStorageAccounts linkedStorageAccounts = manager.linkedStorageAccounts();
    LinkedStorageAccountsResource query = linkedStorageAccounts.get("jdif-storage-westus-rg", "jdif-dev-oms", DataSourceType.QUERY);
    LinkedStorageAccountsResource alerts = linkedStorageAccounts.get("jdif-storage-westus-rg", "jdif-dev-oms", DataSourceType.ALERTS);
    LinkedStorageAccountsResource watson = linkedStorageAccounts.get("jdif-storage-westus-rg", "jdif-dev-oms", DataSourceType.AZURE_WATSON);
    LinkedStorageAccountsResource logs = linkedStorageAccounts.get("jdif-storage-westus-rg", "jdif-dev-oms", DataSourceType.CUSTOM_LOGS);
    LinkedStorageAccountsResource ingestion = linkedStorageAccounts.get("jdif-storage-westus-rg", "jdif-dev-oms", DataSourceType.INGESTION);
    System.out.println();

Expected behavior Correctly return success message and continue to next lines of code without printing a stack trace

Screenshots Attached

Setup (please complete the following information):

If you suspect a dependency version mismatch (e.g. you see NoClassDefFoundError, NoSuchMethodError or similar), please check out Troubleshoot dependency version conflict article first. If it doesn't provide solution for the problem, please provide:

Additional context Add any other context about the problem here.

Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

joshfree commented 1 year ago

@weidongxu-microsoft could you please assist?

/cc @srnagar

srnagar commented 1 year ago

@KinderBoeing12 from the exception stacktrace, it looks like there's a dependency conflict. Please take a look at the troubleshooting guide for investigating NoSuchMethodError. If you are not able to resolve the version conflicts, could you please provide us with your application dependency tree and also a runnable reproducible sample?

weidongxu-microsoft commented 1 year ago

Thanks Srikanta.

@KinderBoeing12 Here is some additional doc on dependency https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/resourcemanager#dependency-management

One quick solution is to ensure azure-core is latest in your dependencies. At present it is 1.42.0