问题描述
com.azure:azure-identity jar包版本从1.2.0 升级到1.12.2 版本之后报错,错误信息如下:
An attempt was made to call a method that does not exist. The attempt was made from the following location: com.azure.identity.implementation.IdentityClientBase.getConfidentialClient(IdentityClientBase.java:235)The following method did not exist: com.microsoft.aad.msal4j.ConfidentialClientApplicationBuilder.logPii(Z)Lcom/microsoft/aad/msal4j/AbstractApplicationBaseBuilder;The calling method's class, com.azure.identity.implementation.IdentityClientBase, was loaded from the following location: jar:file:/C:/java/soft/gradle-7.4.2-bin/gradle-7.4.2/caches/modules-2/files-2.1/com.azure/azure-identity/1.12.2/e12bc63202063589f68318bd5a1b4d1a8ae88fb6/azure-identity-1.12.2.jar!/com/azure/identity/implementation/IdentityClientBase.classThe called method's class, com.microsoft.aad.msal4j.ConfidentialClientApplicationBuilder,isavailablefromthefollowinglocations:jar:file:/C:/java/soft/gradle−7.4.2−bin/gradle−7.4.2/caches/modules−2/files−2.1/com.microsoft.azure/msal4j/1.11.0/38df9693f67ea1f01f35ebbe9411f0760c9ac77f/msal4j−1.11.0.jar!/com/microsoft/aad/msal4j/ConfidentialClientApplicationBuilder.classThe called method's class hierarchy was loaded from the following locations: com.microsoft.aad.msal4j.ConfidentialClientApplication.Builder: file:/C:/java/soft/gradle-7.4.2-bin/gradle-7.4.2/caches/modules-2/files-2.1/com.microsoft.azure/msal4j/1.11.0/38df9693f67ea1f01f35ebbe9411f0760c9ac77f/msal4j-1.11.0.jar com.microsoft.aad.msal4j.AbstractClientApplicationBase.Builder: file:/C:/java/soft/gradle-7.4.2-bin/gradle-7.4.2/caches/modules-2/files-2.1/com.microsoft.azure/msal4j/1.11.0/38df9693f67ea1f01f35ebbe9411f0760c9ac77f/msal4j-1.11.0.jarAction:Correct the classpath of your application so that it contains compatible versions of the classes com.azure.identity.implementation.IdentityClientBase and com.microsoft.aad.msal4j.ConfidentialClientApplication$Builder
错误分析
应用日志显示存在依赖管理错误导致的method not found 报错。
- The following method did not exist: com.microsoft.aad.msal4j.ConfidentialClientApplicationBuilder.logPii(Z)Lcom/microsoft/aad/msal4j/AbstractApplicationBaseBuilder;
- The called method's class hierarchy was loaded from the following locations: com.microsoft.aad.msal4j.ConfidentialClientApplication.Builder: file:/C:/java/soft/gradle-7.4.2-bin/gradle-7.4.2/caches/modules-2/files-2.1/com.microsoft.azure/msal4j/1.11.0/38df9693f67ea1f01f35ebbe9411f0760c9ac77f/msal4j-1.11.0.jar
需要调整class path以确保能读取到正确的依赖包。
Correct the classpath of your application so that it contains compatible versions of the classes com.azure.identity.implementation.IdentityClientBase and com.microsoft.aad.msal4j.ConfidentialClientApplication$Builder
综合以上,错误的原因是项目依赖中可能存在了多个版本的msal4j。当前解析出的msal4j-1.11.0.jar与升级后的azure-identity-1.12.2不兼容。
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
标签:aad,msal4j,7.4,报错,版本,azure,com,microsoft From: https://blog.51cto.com/u_13773780/12260294