Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Java SDK - NoSuchMethodError in Jackson when using Region methods

I'm trying to use the AWS Java SDK to access my Elastic Transcoder jobs. But, the jobs are done in a different region than my development machine. When I try to establish the ElasticTranscoderClient and set it's region I get the following error:

java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectMapper.enable([Lcom/fasterxml/jackson/core/JsonParser$Feature;)Lcom/fasterxml/jackson/databind/ObjectMapper;
    at com.amazonaws.partitions.PartitionsLoader.<clinit>(PartitionsLoader.java:54)
    at com.amazonaws.regions.RegionMetadataFactory.create(RegionMetadataFactory.java:30)
    at com.amazonaws.regions.RegionUtils.initialize(RegionUtils.java:66)
    at com.amazonaws.regions.RegionUtils.getRegionMetadata(RegionUtils.java:54)
    at com.amazonaws.regions.RegionUtils.getRegion(RegionUtils.java:107)
    at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:233)
    at com.amazonaws.client.builder.AwsClientBuilder.withRegion(AwsClientBuilder.java:222)

I will emphasis that this only happens when I try to use regions with the client (true for any AWS client I try to use)

Looking around online it seems that this is likely caused by the Jackson version not being sufficiently high, but I don't know how to fix this since it's the AWS SDK's dependency, not my project's.

Has anyone else had this issue? Is this really a dependency issue or is that just a red herring?

Edit: Using SDK Version 1.11.60

like image 544
Valevalorin Avatar asked Dec 02 '16 17:12

Valevalorin


People also ask

What is the default region for all SDK in AWS?

AWS clients created by using the client constructor will not automatically determine region from the environment and will, instead, use the default SDK region (USEast1).

Can you interface with AWS using Java SDK?

Develop and deploy applications with the AWS SDK for Java. The SDK makes it easy to call AWS services using idiomatic Java APIs.

What is AWS Java SDK bundle?

AWS SDK for Java - Bundle A single bundled dependency that includes all service and dependent JARs with third-party libraries relocated to different namespaces.


1 Answers

I ran into this as well. So far, the following in my pom.xml (my project uses maven) seems to fix it:

<dependency>
  <groupId>com.amazonaws</groupId>
  <artifactId>aws-java-sdk</artifactId>
  <version>1.11.125</version>
</dependency>

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-core</artifactId>
  <version>2.5.3</version>
</dependency>

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-annotations</artifactId>
  <version>2.5.3</version>
</dependency>

<dependency>
  <groupId>com.fasterxml.jackson.core</groupId>
  <artifactId>jackson-databind</artifactId>
  <version>2.5.3</version>
</dependency>
like image 150
timdev Avatar answered Sep 19 '22 16:09

timdev