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

使用Java将Parquet转为Delta时遭遇Scala依赖异常求助

解决Parquet转Delta时的scala/$less$colon$less类找不到异常

问题根源

你遇到的NoClassDefFoundError本质是Scala版本不匹配:

  • 引入的Delta依赖(delta-core_2.13、delta-iceberg_2.13)是基于Scala 2.13编译的
  • 但你的scala-library依赖版本是2.12.17,两个版本的Scala标准库不兼容,导致运行时找不到Scala内置类scala.$less$colon$less(即Scala中::操作符对应的底层类)

解决方案

统一Scala版本,二选一即可:

方案1:将Delta依赖切换为Scala 2.12版本

保留现有scala-library 2.12.17,把Delta依赖的artifactId后缀从_2.13改为_2.12:

<dependency>
    <groupId>io.delta</groupId>
    <artifactId>delta-core_2.12</artifactId>
    <version>2.3.0</version>
</dependency>
<dependency>
    <groupId>io.delta</groupId>
    <artifactId>delta-iceberg_2.12</artifactId>
    <version>2.3.0</version>
</dependency>
<dependency>
    <groupId>org.scala-lang</groupId>
    <artifactId>scala-library</artifactId>
    <version>2.12.17</version>
</dependency>

方案2:升级Scala库到2.13版本

保留Delta的_2.13依赖,将scala-library版本升级到2.13.x(推荐2.13.10,与Delta 2.3.0兼容):

<dependency>
    <groupId>io.delta</groupId>
    <artifactId>delta-core_2.13</artifactId>
    <version>2.3.0</version>
</dependency>
<dependency>
    <groupId>io.delta</groupId>
    <artifactId>delta-iceberg_2.13</artifactId>
    <version>2.3.0</version>
</dependency>
<dependency>
    <groupId>org.scala-lang</groupId>
    <artifactId>scala-library</artifactId>
    <version>2.13.10</version>
</dependency>

额外注意

确保你的Spark依赖版本与Delta 2.3.0兼容,Delta 2.3.0对应Spark 3.3.x版本,若未引入Spark依赖,需补充对应版本的Spark核心、SQL等依赖。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.22 02:12:06