【问题标题】:NoSuchFieldError - Is it possible to include both httpclient-4.3.3 jar and httpclient-4.2.5 jar in the same applicationNoSuchFieldError - 是否可以在同一个应用程序中同时包含 httpclient-4.3.3 jar 和 httpclient-4.2.5 jar
【发布时间】:2015-06-15 09:45:23
【问题描述】:
我的项目带来了很多相互关联的依赖。其中一个需要 httpclient-4.3.3 和 apache cassandra-all 引入需要 httpclient-4.2.5 版本的 libthrift 0.9.1。
我正在尝试运行 map reduce 作业,并在日志 java.lang.NoSuchFieldError: INSTANCE 中看到一条 FATAL 消息
有什么想法吗?
【问题讨论】:
标签:
java
apache-httpclient-4.x
thrift
nosuchfieldexception
【解决方案1】:
对不起,我是在 hadoop/map-reduce/yarn 环境中开发的新手。我发现了这个问题。 /hadoop/share/common/lib 有 httpclient-4.2.5 和 httpcore-4.2.5 jars。用 4.3.3 jar 替换它们解决了这个问题。
【解决方案2】:
没错。 DefaultConnectionKeepAliveStrategy 不包含静态字段
public static final DefaultConnectionKeepAliveStrategy INSTANCE = new DefaultConnectionKeepAliveStrategy();
在 4.2.5 版中