简体   繁体   中英

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

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>

您可以使用 aws sdk 2.0 解决此问题,例如 software.amazon.awssdk:2.15.71

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