问题描述
尽管我还没有找到适合我的正确解决方案,但我已经在这里看到了由各种类引发的异常的此类错误.
I've seen this type of error over here for exceptions that are thrown by various classes, though I haven't found the right solution for mine just yet.
我正在尝试使AWS Java SDK在本地工作,因此我可以编写一个测试应用程序,以从Kinesis流中读取数据.问题是,当我运行init()
静态方法时,遇到以下错误:
I'm trying to get AWS Java SDK work locally so I can write a test application that reads data from a Kinesis stream.Problem is, when I run the init()
static method I encounter the following error:
Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.http.impl.conn.DefaultClientConnectionOperator.<init>
(Lorg/apache/http/conn/scheme/SchemeRegistry;Lorg/apache/http/conn/DnsResolver;)V
现在,这不是我抛出的第一个错误.在此之前,我已经被抛出了四个或五个异常,而所有这些异常的解决方案只是将一些jar导入到项目中.例如:
Now, this is not the first error I've been thrown. I've been thrown four or five exceptions prior to this one, and the solution to all of them was just importing some jar's into the project. e.g.:
- apache-httpcomponents-httpclient.jar
- com.fasterxml.jackson.databind.jar
- commons-codec-1.9.jar/commons-codec-1.9-javadoc.jar/commons-codec-1.9-sources.jar
- httpclient-4.2.jar
- httpcore-4.0.1.jar
我在附近的其他线程中看到它可能是httpcore
库的版本,但是我导入了最新的库.
I've seen in other threads around here that it could be the version of the httpcore
library, however I imported the latest one.
有什么想法可以解决这个问题吗?我正在考虑重新开始,因为我的项目似乎是很多进口商品,但我不确定我是否会真正利用它.此外,我无法调试AWS开发工具包的二进制导入(还是不能?).
Any ideas how I can resolve this? I'm thinking about starting over, as my project seems to be a heap of imports I'm not sure I'll actually utilize. Furthermore, I can't debug the binary imports of the AWS SDK (or can't I?).
干杯.
推荐答案
问题解决了,我逐渐将缺少的库添加到项目中,并且当apache httpclient jar版本为4.0或更高版本时,没有任何先前版本相矛盾.
Problem solved, I gradually added the missing libraries to the project and when the apache httpclient jar should be version 4.0 or later, and without any previous version to contradict.
我导入了httpclient-4.2.jar
并且有效.
除此之外,我只是解决了导入joda-time-2.4.jar
之后的异常,它已全部启动并运行.
Other than that, I just solved the exception that followed by importing joda-time-2.4.jar
and it's all up and running.
这篇关于AWS Java SDK错误-java.lang.NoSuchMethodError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!