【Azure Developer】com.azure:azure-identity jar包版本从1.2.0 升级到1.12.2 版本之后报错

本文涉及的产品
Serverless 应用引擎 SAE,800核*时 1600GiB*时
容器镜像服务 ACR,镜像仓库100个 不限时长
容器服务 Serverless 版 ACK Serverless,317元额度 多规格
简介: 在将 `com.azure:azure-identity` 的 jar 包版本从 1.2.0 升级到 1.12.2 后出现错误,错误信息表明存在方法未找到的问题。分析显示这是由于依赖管理错误导致,需要调整 classpath 确保使用兼容版本的依赖包。当前项目中 msal4j-1.11.0.jar 与 azure-identity-1.12.2 不兼容。

问题描述

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不兼容。

 

 


当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!

相关文章
|
2月前
|
Java 中间件 测试技术
java依赖冲突解决问题之jar包版本冲突无法通过升降级解决时如何解决
java依赖冲突解决问题之jar包版本冲突无法通过升降级解决时如何解决
|
2月前
|
Java Maven C++
【Azure Developer】记录一次使用Java Azure Key Vault Secret示例代码生成的Jar包,单独运行出现 no main manifest attribute, in target/demo-1.0-SNAPSHOT.jar 错误消息
【Azure Developer】记录一次使用Java Azure Key Vault Secret示例代码生成的Jar包,单独运行出现 no main manifest attribute, in target/demo-1.0-SNAPSHOT.jar 错误消息
|
2月前
|
Java Linux Shell
【Azure 应用服务】部署Jar到App Service for Linux,因启动命令路径配置错误而引起:( Application Error 问题
【Azure 应用服务】部署Jar到App Service for Linux,因启动命令路径配置错误而引起:( Application Error 问题
|
2月前
|
Java Spring
【Azure 应用服务】一个 App Service 同时部署运行两个及多个 Java 应用程序(Jar包)
【Azure 应用服务】一个 App Service 同时部署运行两个及多个 Java 应用程序(Jar包)
|
2月前
|
Java Windows
【Azure 应用服务】App Service 部署txt静态文件和Jar包在不同目录中的解决办法
【Azure 应用服务】App Service 部署txt静态文件和Jar包在不同目录中的解决办法
|
2月前
|
前端开发 JavaScript Java
【Azure 应用服务】App Service For Windows 中如何设置代理实现前端静态文件和后端Java Spring Boot Jar包
【Azure 应用服务】App Service For Windows 中如何设置代理实现前端静态文件和后端Java Spring Boot Jar包
|
2月前
|
Java Spring
【Azure 应用服务】记一次Azure Spring Cloud 的部署错误 (az spring-cloud app deploy -g dev -s testdemo -n demo -p ./hellospring-0.0.1-SNAPSHOT.jar --->>> Failed to wait for deployment instances to be ready)
【Azure 应用服务】记一次Azure Spring Cloud 的部署错误 (az spring-cloud app deploy -g dev -s testdemo -n demo -p ./hellospring-0.0.1-SNAPSHOT.jar --->>> Failed to wait for deployment instances to be ready)
|
2月前
|
Java 测试技术 Maven
java依赖冲突解决问题之多个版本的jar包中都没有找到缺失的方法如何解决
java依赖冲突解决问题之多个版本的jar包中都没有找到缺失的方法如何解决
|
2月前
|
分布式计算 DataWorks Java
DataWorks操作报错合集之CDH节点上传jar包时遇到报错,该怎么办
DataWorks是阿里云提供的一站式大数据开发与治理平台,支持数据集成、数据开发、数据服务、数据质量管理、数据安全管理等全流程数据处理。在使用DataWorks过程中,可能会遇到各种操作报错。以下是一些常见的报错情况及其可能的原因和解决方法。
|
3月前
|
Java
[JarEditor]可直接修改jar包的IDEA插件
### 修改JAR包变得更简单:JarEditor插件简介 **背景:** 开发中常需修改JAR包中的class文件,传统方法耗时费力。JarEditor插件让你一键编辑JAR包内文件,无需解压。 **插件使用:** 1. **安装:** 在IDEA插件市场搜索JarEditor并安装。 2. **修改class:** 打开JAR文件中的class,直接编辑,保存后一键构建更新JAR。 3. **文件管理:** 右键菜单支持在JAR内新增/删除/重命名文件等操作。 4. **搜索:** 使用内置搜索功能快速定位JAR包内的字符串。
334 2
[JarEditor]可直接修改jar包的IDEA插件