简体   繁体   中英

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. 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

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. eg:

  • 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

I've seen in other threads around here that it could be the version of the httpcore library, however I imported the latest one.

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?).

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.

I imported httpclient-4.2.jar and it worked.

Other than that, I just solved the exception that followed by importing joda-time-2.4.jar and it's all up and running.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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