Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removal of PASCAL_CASE_TO_CAMEL_CASE creates compatibility problems #2897

Closed
skohlmann opened this issue Oct 20, 2020 · 16 comments
Closed

Removal of PASCAL_CASE_TO_CAMEL_CASE creates compatibility problems #2897

skohlmann opened this issue Oct 20, 2020 · 16 comments

Comments

@skohlmann
Copy link

Describe the bug
The removal of com.fasterxml.jackson.databind.PropertyNamingStrategy#PASCAL_CASE_TO_CAMEL_CASE creates problems within AWS environments. The field is referenced by com.amazonaws.util.EC2MetadataUtils (transitive reference in com.amazonaws:aws-java-sdk-core:jar:1.11.883) and raise a NoSuchFieldError if overwriting the Jackson environment of AWS com.amazonaws:aws-java-sdk-core (which is Jackson 2.6.7).

Version information
2.12.0-rc1

To Reproduce

Call com.amazonaws.services.sqs.AmazonSQSClientBuilder#defaultClient() (of package com.amazonaws:aws-java-sdk-sqs:jar:1.11.883) with com.fasterxml.jackson.core:jackson-databind:jar:2.12.0-rc1.

Expected behavior
There is no NoSuchFieldError in combination of com.amazonaws:aws-java-sdk-core and Jackson.

@skohlmann skohlmann added the to-evaluate Issue that has been received but not yet evaluated label Oct 20, 2020
@cowtowncoder
Copy link
Member

Hi @skohlmann! Yes, thank you for reporting this -- release candidates are meant to find out accidental changes like this.
Issue has been resolved as #2880 and will be included in 2.12.0-rc2 once we get that out.

@cowtowncoder cowtowncoder removed the to-evaluate Issue that has been received but not yet evaluated label Dec 9, 2020
@hohwille
Copy link

I do not know what is happening here but with AWS s3-2.16.1.jar in combination with jackson-databind-2.16.0.jar I am getting this:

Caused by: java.lang.NoSuchFieldError: PASCAL_CASE_TO_CAMEL_CASE
	at software.amazon.awssdk.regions.internal.util.EC2MetadataUtils.<clinit>(EC2MetadataUtils.java:95)
	at software.amazon.awssdk.regions.providers.InstanceProfileRegionProvider.tryDetectRegion(InstanceProfileRegionProvider.java:68)
	at software.amazon.awssdk.regions.providers.InstanceProfileRegionProvider.getRegion(InstanceProfileRegionProvider.java:52)
	at software.amazon.awssdk.regions.providers.AwsRegionProviderChain.getRegion(AwsRegionProviderChain.java:51)
	at software.amazon.awssdk.awscore.client.builder.AwsDefaultClientBuilder.regionFromDefaultProvider(AwsDefaultClientBuilder.java:202)
	at software.amazon.awssdk.awscore.client.builder.AwsDefaultClientBuilder.resolveRegion(AwsDefaultClientBuilder.java:184)
	at software.amazon.awssdk.awscore.client.builder.AwsDefaultClientBuilder.finalizeChildConfiguration(AwsDefaultClientBuilder.java:135)
	at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.syncClientConfiguration(SdkDefaultClientBuilder.java:157)
	at software.amazon.awssdk.services.s3.DefaultS3ClientBuilder.buildClient(DefaultS3ClientBuilder.java:27)
	at software.amazon.awssdk.services.s3.DefaultS3ClientBuilder.buildClient(DefaultS3ClientBuilder.java:22)
	at software.amazon.awssdk.core.client.builder.SdkDefaultClientBuilder.build(SdkDefaultClientBuilder.java:129)

AWS code is:

    private static final ObjectMapper MAPPER = new ObjectMapper();
    // ...
    private EC2MetadataUtils() {
    }

    static {
        MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        MAPPER.setPropertyNamingStrategy(PropertyNamingStrategy.PASCAL_CASE_TO_CAMEL_CASE);
    }

So was it fixed at all? Or breaking change redone after fix? Any sync with AWS guys?
This turns out as a complete blocker for S3 client usage.
Any workarounds?

@hohwille
Copy link

aws/aws-sdk-java#3098

@hohwille
Copy link

Workaround seems to be jackson-databind-2.15.4.jar. According to maven central that was released on 2024-02-15 17:35 while 2.16.0 what sounds more recent was released on 2023-11-15 22:38 and "latest" 2.16.1 on 2023-12-24 04:31.
So I will just ignore 2.16.x releases for now and should be able to proceed. Hope this may help others stumbling over the same problem...

@pjfanning
Copy link
Member

@hohwille
Copy link

@hohwille why not use aws 2.24.x or 2.23.x? The AWS code was changed - see https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/java/com/amazonaws/util/EC2MetadataUtils.java

@pjfanning thanks for pointing that out. Usually the first thing I do when adding a dependency is checking maven central for the latest version. Indeed the version 2.16.1 is rather old so my mistake. Great that it can be solved either with the proper version of jackson (2.15.4) or a newer version of AWS sdk for s3. So all solved 👍

@mattbishop
Copy link

The reason I can't update AWS SDK versions is because I am using the Camel AWS integration and cannot upgrade that at the moment.

Better for Jackson to preserve the API for minor library upgrades, as per Semantic Versioning conventions. When Jackson moves to 3.x, a major version change, then these kinds of breaking changes can be expected.

https://semver.org

@cowtowncoder
Copy link
Member

In general, tho, we do try to keep compatibility in a way like you suggest.

But at this point, field has been removed tho and trying to add it back would be even more confusing as some intermediate versions wouldn't have it.

@danjee
Copy link

danjee commented Mar 27, 2024

I am having the same issue with jackson v 2.17.0 and aws sdk 2.25.17 (latest as today)

@danjee
Copy link

danjee commented Mar 27, 2024

HI @cowtowncoder. It worked with 2.15.4 so most likely the fix wasn't merged in 2.17.0 even though is more recent than the fix.

@cowtowncoder
Copy link
Member

@danjee at this point there isn't anything planned to be changed on Jackson side.

Not sure what "it worked" here specifically means, but it sounds like newer version of AWS client works with newer versions of Jackson so that's probably the way forward.

@danjee
Copy link

danjee commented Mar 28, 2024

Not sure what "it worked" here specifically means, but it sounds like newer version of AWS client works with newer versions of Jackson so that's probably the way forward.

I've tried with the latest aws sdk version2.25.17 (latest as yesterday) and jackson 2.17.0 as I've stated in the previous comment and the error popped up. Downgrading jackson lib to 2.15.2 and keeping the aws lib to 2.25.17 (latest as yesterday) it "worked" as in the error didn't appeared.

at this point there isn't anything planned to be changed on Jackson side.

My guess was that for 2.15.2 the fix was applied and for 2.17.0 it wasn't.
Thanks

@cowtowncoder
Copy link
Member

cowtowncoder commented Mar 28, 2024

No, there was no fix in 2.15.2 -- but rather already deprecated (in 2.7) field was finally removed from 2.16. Assumption being that since it has been deprecated for so long -- with a compatible replacement since 2.7, to upgrade to -- no client would be using field any longer. Looks like this was being optimistic.

But given this, there are multiple releases without said deprecated field and it will not be reintroduced. Dependant libraries/frameworks need to use the replacement strategy.

AWS sdk must be upgraded to use the new PropertyNamingStrategy to work with Jackson 2.16.x and above.

@cowtowncoder
Copy link
Member

btw, which AWS sdk library are we talking about? https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-core has version only to 1.12.x

@danjee
Copy link

danjee commented Mar 29, 2024

https://mvnrepository.com/artifact/software.amazon.awssdk/s3/2.25.17 - I see that they made 2.25.18 the same day. I'll try that too. Thanks

@cowtowncoder
Copy link
Member

@danjee Did it work out? And if so, which Jackson version does it depend on (MvnRepository does not show Jackson as direct dependency and I couldn't figure out which transitive dep would show it).

davidfurey added a commit to guardian/facia-tool that referenced this issue May 8, 2024
This is required because v1.0.0-M15 depends on software.amazon.awssdk:dynamodb:2.15.78 which depends on jackson-databind:2.10.5.1, which is binary incompatible with jackson-databind:2.16.2 which is depended on by com.amazonaws:aws-java-sdk-core:1.12.470.

Scanamo v1.0.0 uses software.amazon.awssdk:dynamodb:2.23.4

See FasterXML/jackson-databind#2897
davidfurey added a commit to guardian/facia-tool that referenced this issue May 8, 2024
This is required because v1.0.0-M15 depends on software.amazon.awssdk:dynamodb:2.15.78 which depends on jackson-databind:2.10.5.1, which is binary incompatible with jackson-databind:2.16.2 which is depended on by com.amazonaws:aws-java-sdk-core:1.12.470.

Scanamo v1.0.0 uses software.amazon.awssdk:dynamodb:2.23.4

See FasterXML/jackson-databind#2897
davidfurey added a commit to guardian/facia-tool that referenced this issue May 8, 2024
This is required because v1.0.0-M15 depends on software.amazon.awssdk:dynamodb:2.15.78 which depends on jackson-databind:2.10.5.1, which is binary incompatible with jackson-databind:2.16.2 which is depended on by com.amazonaws:aws-java-sdk-core:1.12.470.

Scanamo v1.0.0 uses software.amazon.awssdk:dynamodb:2.23.4

See FasterXML/jackson-databind#2897
jonathonherbert pushed a commit to guardian/facia-tool that referenced this issue May 9, 2024
This is required because v1.0.0-M15 depends on software.amazon.awssdk:dynamodb:2.15.78 which depends on jackson-databind:2.10.5.1, which is binary incompatible with jackson-databind:2.16.2 which is depended on by com.amazonaws:aws-java-sdk-core:1.12.470.

Scanamo v1.0.0 uses software.amazon.awssdk:dynamodb:2.23.4

See FasterXML/jackson-databind#2897
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants