我正在尝试运行使用 Univocity CSV Parser 的 Scala Spark 作业,并且在升级以支持字符串分隔符(与仅字符)之后,当我在集群中运行我的 jar 时出现以下错误。在我的 IDEA IDE 中本地运行它会产生没有错误的预期结果。
ERROR yarn.ApplicationMaster: User class threw exception: java.lang.NoSuchMethodError: com.univocity.parsers.csv.CsvFormat.setDelimiter(Ljava/lang/String;)V
java.lang.NoSuchMethodError: com.univocity.parsers.csv.CsvFormat.setDelimiter(Ljava/lang/String;)V
我尝试了以下方法:通过检查依赖关系树消除了所有冲突的单义性解析器: mvn dependency:tree -Dverbose -Dincludes=com.univocity:univocity-parsers 产生:
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ preval ---
[INFO] dataqa:preval:jar:1.0-SNAPSHOT
[INFO] \- com.univocity:univocity-parsers:jar:2.8.2:compile
我还尝试在运行 spark 作业时设置 spark.executor.userClassPathFirst=true 配置,但行为没有变化。
这是我的 pom.xml 中的依赖项部分:
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.12</version>
</dependency>
<!--
Spark library. spark-core_2.xx must match the scala language version
-->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.0.0</version>
</dependency>
<!--
Spark SQL library. spark-sql_2.xx must match the scala language version
-->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.0.0</version>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--
Library to make REST API call
-->
<dependency>
<groupId>com.typesafe.play</groupId>
<artifactId>play-ahc-ws-standalone_2.11</artifactId>
<version>2.0.0-M1</version>
</dependency>
<!--
Parses delimited files
-->
<dependency>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>2.8.2</version>
<type>jar</type>
</dependency>
<!-- https://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple -->
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
我想知道 Spark 是否具有覆盖我的版本的内置依赖项(2.8 是第一个支持字符串参数的版本。以前,它只支持字符)。
有什么见解吗?