You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用kusto.Ingest 2.5.1时msal4j.JsonHelper初始化失败求助

问题

使用kusto.Ingest 2.5.1版本时遇到如下错误:

*ERROR*| [Timer-985]| com.microsoft.azure.kusto.ingest.ResourceManager| Error in refreshIngestionAuthToken.| com.microsoft.azure.kusto.ingest.exceptions.IngestionServiceException: Error refreshing IngestionAuthToken
    at com.microsoft.azure.kusto.ingest.ResourceManager.refreshIngestionAuthToken(ResourceManager.java:199)
    at com.microsoft.azure.kusto.ingest.ResourceManager.access$500(ResourceManager.java:22)
    at com.microsoft.azure.kusto.ingest.ResourceManager$1RefreshIngestionAuthTokenTask.run(ResourceManager.java:102)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)
Caused by: com.microsoft.azure.kusto.data.exceptions.DataServiceException: Error acquiring ApplicationAccessToken
    at com.microsoft.azure.kusto.data.auth.ConfidentialAppTokenProviderBase.acquireNewAccessToken(ConfidentialAppTokenProviderBase.java:32)
    at com.microsoft.azure.kusto.data.auth.MsalTokenProviderBase.acquireAccessToken(MsalTokenProviderBase.java:46)
    at com.microsoft.azure.kusto.data.ClientImpl.initHeaders(ClientImpl.java:196)
    at com.microsoft.azure.kusto.data.ClientImpl.executeToJsonResult(ClientImpl.java:135)
    at com.microsoft.azure.kusto.data.ClientImpl.execute(ClientImpl.java:76)
    at com.microsoft.azure.kusto.data.ClientImpl.execute(ClientImpl.java:71)
    at com.microsoft.azure.kusto.data.ClientImpl.execute(ClientImpl.java:66)
    at com.microsoft.azure.kusto.ingest.ResourceManager.refreshIngestionAuthToken(ResourceManager.java:190)
    ... 4 common frames omitted
Caused by: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Could not initialize class com.microsoft.aad.msal4j.JsonHelper
    at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
    at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1928)
    at com.microsoft.azure.kusto.data.auth.ConfidentialAppTokenProviderBase.acquireNewAccessToken(ConfidentialAppTokenProviderBase.java:30)

错误根源是msal4j的JsonHelper类无法初始化。根据文档,kusto.Ingest 2.5.1默认依赖kusto.Data 2.5.1,而kusto.Data 2.5.1默认使用msal4j 1.9.1,但该版本的JsonHelper没有初始化方法。于是将msal4j升级到1.11.2版本(该版本的JsonHelper包含私有构造方法),但错误依旧。

已完成的排查:

  • 依赖清单、嵌入依赖及导出依赖均显示msal4j为1.11.2版本,kusto.data和kusto.ingest为2.5.1版本;
  • 反编译jar包中的JsonHelper.class文件,确认其包含初始化方法。

请问还遗漏了什么排查点?

排查建议
  • 检查类加载器冲突:应用中可能存在多个类加载器,导致旧版本的JsonHelper被加载。添加JVM参数-verbose:class启动应用,查看JsonHelper类实际加载的是哪个版本的jar包。
  • 检查msal4j的依赖传递冲突:msal4j 1.11.2可能依赖特定版本的JSON处理库(如Jackson),如果项目中存在版本不兼容的Jackson依赖,会导致JsonHelper初始化失败。通过依赖分析工具(如Maven的dependency:tree或Gradle的dependencies任务)检查JSON相关依赖的版本一致性,确保msal4j所需的Jackson版本被正确引入。
  • 检查运行时环境的类路径:打包后的应用(如war、jar)中可能仍包含旧版本的msal4j jar包,或者类路径中存在优先级更高的旧版本依赖。解压最终的部署包,检查lib目录下的msal4j版本,或者通过System.getProperty("java.class.path")输出运行时类路径,确认是否有旧版本msal4j存在。
  • 检查静态初始化失败原因:NoClassDefFoundError提示无法初始化类,可能是JsonHelper的静态代码块执行失败(而非构造方法问题)。查看msal4j 1.11.2的JsonHelper源码,检查静态变量或静态代码块是否依赖其他缺失的类或资源,再排查这些依赖是否在运行时存在。
  • 清理构建缓存:构建工具(Maven/Gradle)的缓存中可能残留旧版本的依赖,导致打包时混入旧代码。执行清理命令(如mvn clean或gradle clean)后重新构建项目,确保所有依赖都是最新的。

内容的提问来源于stack exchange,提问作者superninja

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 15:03:18