Skip to content

software.amazon.awssdk.http.SdkHttpService error for modular project #1429

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

Closed
adityasrini opened this issue Sep 14, 2019 · 2 comments
Closed
Labels
guidance Question that needs advice or information.

Comments

@adityasrini
Copy link

Expected Behavior

The app starts and runs.

Current Behavior

A stacktrace is produced and the app crashes.

Possible Solution

The S3Client seems to be the problematic piece of code here.

Steps to Reproduce (for bugs)

  • Create a modular project
  • Create a jlinked image (Using the badass plugin)
  • run ./build/image/bin/hello

Full code here:
https://github.com/adityasrini/modular-hello

Stacktrace here:
https://gist.github.com/adityasrini/780d73126863cbecea9fd524151f9df6

Context

This is in the context of building a modularized java application. I am using jlink to generate the modularized app through Gradle and the Badass plugin. This seems to be the only project causing this issue as can be seen in the exception that's thrown when only the S3Client is initialized with dummy credentials.

Your Environment

  • AWS Java SDK version used: 2.8.1
  • JDK version used: 12.0.2
  • Operating System and version: macOS 10.14.6
@zoewangg
Copy link
Contributor

zoewangg commented Sep 16, 2019

You might need to explicitly setting the http client because by default, the SDK will try to detect the http client from the class path if it is not specified, and it might not work for module path.

S3AsyncClient.builder()
                        .region(Region.US_WEST_2)
                        .httpClientBuilder(NettyNioAsyncHttpClient.builder())
                        .credentialsProvider(CREDENTIALS_PROVIDER_CHAIN)
                        .build();

Here is the sample code to use the SDK via module path: https://github.com/aws/aws-sdk-java-v2/tree/master/test/module-path-tests

@zoewangg zoewangg added the guidance Question that needs advice or information. label Sep 16, 2019
@adityasrini
Copy link
Author

adityasrini commented Sep 17, 2019

@zoewangg It worked! Documentation specifying how modular Java should be configured would be helpful.

EDIT: Closing it since it's not a bug, but ideally it would be resolved with updated docs.

aws-sdk-java-automation added a commit that referenced this issue May 27, 2021
…c3577993e

Pull request: release <- staging/646f33c2-fb4f-45cc-81d6-3a8c3577993e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

2 participants