spring - Spring batch和cloudera hadoop之间的版本不兼容

标签 spring maven hadoop spring-batch

我在尝试 spring batch word count 程序时遇到了这样的版本问题:

ERROR [org.springframework.batch.core.step.AbstractStep] - <Encountered an error executing the step>
java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.Counter, but class was expected

我使用 Cloudera Hadoop2 cdh4.5.0 和 Spring hadoop 版本 1.0.1.RELEASE。我无法确定确切的问题,因为 Spring batch 与 hadoop cdh4 兼容。

我的依赖树如下图所示。

[INFO] org.springframework.data:batch-wordcount:jar:0.0.1
[INFO] +- org.springframework:spring-context:jar:3.0.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.0.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.0.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:3.0.5.RELEASE:compile
[INFO] |  \- org.springframework:spring-asm:jar:3.0.5.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:3.0.5.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-tx:jar:3.0.5.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework.batch:spring-batch-core:jar:2.2.0.RELEASE:compile
[INFO] |  +- com.thoughtworks.xstream:xstream:jar:1.3:compile
[INFO] |  |  \- xpp3:xpp3_min:jar:1.1.4c:compile
[INFO] |  +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] +- org.springframework.batch:spring-batch-infrastructure:jar:2.2.0.RELEASE:compile
[INFO] |  \- org.springframework.retry:spring-retry:jar:1.0.2.RELEASE:compile
[INFO] +- org.springframework.batch:spring-batch-test:jar:2.2.0.RELEASE:compile
[INFO] |  +- (junit:junit:jar:4.10:compile - omitted for conflict with 4.11)
[INFO] |  +- (org.springframework:spring-test:jar:3.2.0.RELEASE:compile - omitted for conflict with 3.0.5.RELEASE)
[INFO] |  +- commons-io:commons-io:jar:1.4:compile
[INFO] |  +- commons-dbcp:commons-dbcp:jar:1.2.2:compile
[INFO] |  |  \- commons-pool:commons-pool:jar:1.3:compile
[INFO] |  \- commons-collections:commons-collections:jar:3.2:compile
[INFO] +- junit:junit:jar:4.11:test (scope not updated to compile)
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.springframework.data:spring-data-hadoop:jar:1.0.2.RELEASE:compile
[INFO] +- org.apache.hadoop:hadoop-common:jar:2.0.0-cdh4.5.0:compile
[INFO] |  +- org.apache.hadoop:hadoop-annotations:jar:2.0.0-cdh4.5.0:compile
[INFO] |  |  \- jdk.tools:jdk.tools:jar:1.6:system
[INFO] |  +- com.google.guava:guava:jar:11.0.2:compile
[INFO] |  +- commons-net:commons-net:jar:3.1:compile
[INFO] |  +- javax.servlet:servlet-api:jar:2.5:compile
[INFO] |  +- org.mortbay.jetty:jetty:jar:6.1.26.cloudera.2:compile
[INFO] |  +- org.mortbay.jetty:jetty-util:jar:6.1.26.cloudera.2:compile
[INFO] |  +- com.sun.jersey:jersey-core:jar:1.8:compile
[INFO] |  +- com.sun.jersey:jersey-json:jar:1.8:compile
[INFO] |  |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] |  |  |  \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] |  |  |     \- javax.activation:activation:jar:1.1:compile
[INFO] |  |  \- (com.sun.jersey:jersey-core:jar:1.8:compile - omitted for duplicate)
[INFO] |  +- log4j:log4j:jar:1.2.17:compile
[INFO] |  +- org.apache.hadoop:cloudera-jets3t:jar:2.0.0-cdh4.5.0:compile
[INFO] |  |  \- (net.java.dev.jets3t:jets3t:jar:0.9.0:compile - omitted for conflict with 0.6.1)
[INFO] |  +- net.java.dev.jets3t:jets3t:jar:0.6.1:compile
[INFO] |  |  +- (commons-codec:commons-codec:jar:1.3:compile - omitted for conflict with 1.4)
[INFO] |  |  +- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] |  |  \- (commons-httpclient:commons-httpclient:jar:3.1:compile - omitted for duplicate)
[INFO] |  +- (junit:junit:jar:4.8.2:compile - omitted for conflict with 4.11)
[INFO] |  +- commons-lang:commons-lang:jar:2.5:compile
[INFO] |  +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] |  |  +- commons-digester:commons-digester:jar:1.8:compile
[INFO] |  |  |  +- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] |  |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.6.1:compile
[INFO] |  +- org.slf4j:slf4j-log4j12:jar:1.6.1:runtime
[INFO] |  +- org.codehaus.jackson:jackson-core-asl:jar:1.8.8:compile
[INFO] |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.8.8:compile
[INFO] |  +- net.sf.kosmosfs:kfs:jar:0.3:compile
[INFO] |  +- com.google.protobuf:protobuf-java:jar:2.4.0a:compile
[INFO] |  +- org.apache.hadoop:hadoop-auth:jar:2.0.0-cdh4.5.0:compile
[INFO] |  +- com.jcraft:jsch:jar:0.1.42:compile
[INFO] |  \- org.apache.zookeeper:zookeeper:jar:3.4.5-cdh4.5.0:compile
[INFO] |     \- jline:jline:jar:0.9.94:compile
[INFO] +- org.apache.hadoop:hadoop-hdfs:jar:2.0.0-cdh4.5.0:compile
[INFO] |  +- tomcat:jasper-runtime:jar:5.5.23:compile
[INFO] |  |  \- commons-el:commons-el:jar:1.0:compile
[INFO] +- org.apache.hadoop:hadoop-tools:jar:2.0.0-mr1-cdh4.5.0:compile
[INFO] |  +- com.cloudera.cdh:hadoop-ant:pom:2.0.0-mr1-cdh4.5.0:compile
[INFO] |  \- org.apache.hadoop:hadoop-core:jar:2.0.0-mr1-cdh4.5.0:compile
[INFO] |     +- hsqldb:hsqldb:jar:1.8.0.10:compile
[INFO] |     +- org.eclipse.jdt:core:jar:3.1.1:compile
[INFO] +- org.hamcrest:hamcrest-all:jar:1.1:compile
[INFO] +- org.apache.hadoop:hadoop-client:jar:2.0.0-mr1-cdh4.5.0:compile
[INFO] +- org.apache.hadoop:hadoop-streaming:jar:2.0.0-mr1-cdh4.5.0:compile
[INFO] \- org.springframework:spring-test:jar:3.0.5.RELEASE:compile

此外,省略重复依赖项是否会导致任何错误?

最佳答案

您应该将 1.0.2.RELEASE-cdh4 版本与 Cloudera CDH4 一起使用 - 这些特定于发行版的版本在 Spring 存储库中可用:

<repository>
  <id>spring-releases</id>
  <name>Spring Release Repository</name>
  <url>http://repo.spring.io/libs-release</url>
</repository>

更多信息在这里:https://github.com/spring-projects/spring-hadoop/wiki/Build-with-Cloudera-CDH4

关于spring - Spring batch和cloudera hadoop之间的版本不兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21133953/

相关文章:

java - 在阅读主题后异步提交消息

Spring - 简单地创建Supplier<MyPrototypeBean>

java - maven-compiler-plugin如何与不同的jdk一起工作?

java - 依赖 Maven 项目的测试失败

hadoop - 我对 hive 和Hadoop性能有何期待?

hadoop - 所有内置的可写对象都使用默认的原始比较器吗?

spring - 如何通过 MockMvc 为每个请求设置 servlet 路径

java - 在 Dockerfile 中覆盖继承的 CMD 并不总是有效?

java - 在 Java 跨平台桌面应用程序上接收推送通知

hadoop - CentOS 7 上的 Spark 和 IPython