简体   繁体   English

AWS Java SDK错误 - java.lang.NoSuchMethodError

[英]AWS Java SDK Error - java.lang.NoSuchMethodError

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. 我已经在这里看到了各种类引发的异常的这种类型的错误,尽管我还没有为我找到正确的解决方案。

I'm trying to get AWS Java SDK work locally so I can write a test application that reads data from a Kinesis stream. 我正在尝试让AWS Java SDK在本地运行,这样我就可以编写一个从Kinesis流中读取数据的测试应用程序。 Problem is, when I run the init() static method I encounter the following error: 问题是,当我运行init()静态方法时遇到以下错误:

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

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. 在此之前我已被抛出四到五个例外,并且所有这些的解决方案只是将一些jar导入到项目中。 eg: 例如:

  • apache-httpcomponents-httpclient.jar Apache的httpcomponents-httpclient.jar
  • com.fasterxml.jackson.databind.jar com.fasterxml.jackson.databind.jar
  • commons-codec-1.9.jar / commons-codec-1.9-javadoc.jar / commons-codec-1.9-sources.jar commons-codec-1.9.jar / commons-codec-1.9-javadoc.jar / commons-codec-1.9-sources.jar
  • httpclient-4.2.jar HttpClient的-4.2.jar
  • httpcore-4.0.1.jar 的HttpCore-4.0.1.jar

I've seen in other threads around here that it could be the version of the httpcore library, however I imported the latest one. 我在其他线程中看到它可能是httpcore库的版本,但是我导入了最新版本。

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?). 此外,我无法调试AWS SDK的二进制导入(或者我不能?)。

Cheers. 干杯。

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. 问题解决后,我逐渐将缺少的库添加到项目中,并且当apache httpclient jar应该是4.0或更高版本时,并且没有任何先前版本的矛盾。

I imported httpclient-4.2.jar and it worked. 我导入了httpclient-4.2.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. 除此之外,我刚刚解决了导入joda-time-2.4.jar之后的异常,并且它已全部启动并运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM