【发布时间】:2021-08-19 23:47:33
【问题描述】:
我知道我们已经在这里回答了类似的问题。但由于某种原因,没有一个选项对我有用。
以下是我得到的错误:
User class threw exception: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.introspect.AnnotatedMember.getType()Lcom/fasterxml/jackson/databind/JavaType;
at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector._fullSerializationType(JaxbAnnotationIntrospector.java:1550)
at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector._findContentAdapter(JaxbAnnotationIntrospector.java:1502)
at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.findSerializationContentConverter(JaxbAnnotationIntrospector.java:914)
at com.fasterxml.jackson.databind.introspect.AnnotationIntrospectorPair.findSerializationContentConverter(AnnotationIntrospectorPair.java:388)
at com.fasterxml.jackson.databind.ser.std.StdSerializer.findConvertingContentSerializer(StdSerializer.java:266)
at com.fasterxml.jackson.databind.ser.std.AsArraySerializerBase.createContextual(AsArraySerializerBase.java:197)
以下是我添加的依赖项。我尝试删除所有杰克逊依赖项并单独添加所需的版本。
dependencies {
compile (group: 'org.scala-lang', name: 'scala-library', version: '2.11.8') {
exclude group: 'com.fasterxml.jackson.module'
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'com.fasterxml.jackson.dataformat'
exclude group: 'com.fasterxml.jackson.datatype'
}
compile (group: 'org.apache.spark', name: 'spark-core_2.11', version: '2.3.0') {
exclude group: 'com.fasterxml.jackson.module'
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'com.fasterxml.jackson.dataformat'
exclude group: 'com.fasterxml.jackson.datatype'
}
compile (group: 'org.apache.spark', name: 'spark-sql_2.11', version: '2.3.0') {
exclude group: 'com.fasterxml.jackson.module'
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'com.fasterxml.jackson.dataformat'
exclude group: 'com.fasterxml.jackson.datatype'
}
compile (group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.633') {
exclude group: 'com.fasterxml.jackson.module'
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'com.fasterxml.jackson.dataformat'
exclude group: 'com.fasterxml.jackson.datatype'
}
compile group: 'org.apache.httpcomponents', name: 'httpclient', version: '4.5.2'
compile group: 'com.sun.mail', name: 'javax.mail', version: '1.6.2'
testCompile group: 'junit', name: 'junit', version: '4.12'
compile group: 'net.liftweb', name: 'lift-json_2.11', version: '2.6.3'
compile group: 'net.sf.json-lib', name: 'json-lib', version: '2.4', classifier: 'jdk15'
compile group: 'net.sf.oval', name: 'oval', version: '1.31'
compile (group: 'com.bedatadriven', name: 'jackson-datatype-jts', version: '2.4') {
exclude group: 'com.fasterxml.jackson.module'
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'com.fasterxml.jackson.dataformat'
exclude group: 'com.fasterxml.jackson.datatype'
}
compile (group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-joda', version: '2.11.2') {
exclude group: 'com.fasterxml.jackson.core'
}
compile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.11.2'
compile (group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.11.2') {
exclude group: 'com.fasterxml.jackson.core'
}
compile group: 'com.fasterxml.jackson.core', name: 'jackson-annotations', version: '2.11.2'
compile (group: 'com.fasterxml.jackson.module', name: 'jackson-module-jaxb-annotations', version: '2.11.2') {
exclude group: 'com.fasterxml.jackson.core'
}
compile (group: 'com.fasterxml.jackson.dataformat', name: 'jackson-dataformat-csv', version: '2.11.2') {
exclude group: 'com.fasterxml.jackson.core'
}
// Some custom Jars
compile (group: 'org.springframework', name: 'spring-core', version: '2.5.6') {
exclude group: 'com.fasterxml.jackson.module'
exclude group: 'com.fasterxml.jackson.core'
exclude group: 'com.fasterxml.jackson.dataformat'
exclude group: 'com.fasterxml.jackson.datatype'
}
}
当我在本地系统中运行 spark 作业而不是在 aws emr 集群中时,此配置有效。
【问题讨论】:
-
请注意,您应该将 Spark 和 Scala 库依赖项标记为
provided -
如果我将 Spark 和 Scala 库依赖项标记为已提供,那么将正确使用 EMR 提供的 Spark。我想我应该尝试您提供的以下选项。
标签: scala apache-spark jackson-databind jackson-modules amazon-emr