Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 633
Yuval Herziger Avatar asked Sep 12 '26 04:09

Yuval Herziger


1 Answers

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.

like image 58
Yuval Herziger Avatar answered Sep 13 '26 18:09

Yuval Herziger



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!