Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Getting an UnknownHostException when trying to do a createBucket or putObject
2025-02-14
02:19 PM
553 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a java app in which I'm trying to interface with a NetApp S3 API gateway in order to store large files there.
It was pretty straightforward to make a connection with an S3Client.
And I know that I set things up correctly because I'm able to do a listBuckets and it correctly lists all of the existing buckets.
String accessKeyId = "MyAccessKeyID"; String secretAccesskey = "MySecretAccessKey"; String endpointUrl = "https://theendpointurltomynetappstoragegrid:10444"; StaticCredentialsProvider credentialsProvider = StaticCredentialsProvider.create( AwsBasicCredentials.create(accessKeyId, secretAccesskey)); // Create S3 client S3Client s3Client = S3Client.builder() .credentialsProvider(credentialsProvider) .region(Region.US_EAST_1) .endpointOverride(URI.create(endpointUrl)) .overrideConfiguration(ClientOverrideConfiguration.builder() .build()) .build(); //This actually works fine to list the buckets - indicating I am connecting fine ListBucketsResponse listBucketsResponse = s3Client.listBuckets();
However it crashes with the UnknownHostException when I try to do a createBucket or postObject.
CreateBucketRequest createBucketRequest = CreateBucketRequest.builder() .bucket("testbucket11") .build(); //However this always crashes with a SdkClientException: Received an UnknownHostException s3Client.createBucket(createBucketRequest);
BTW I am able to do a create-bucket through the aws command-line interface.
This actually does create a bucket.
aws --endpoint-url https://theendpointurltomynetappstoragegrid:10444 s3api create-bucket --bucket testbucket11
Any suggestions? Thank you.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
UnknownHostException ==== JAva can not resolve hostname due to DNS resolution issue.
pl try nslookup from java host for
nslookup testbucket11.theendpointurltomynetappstoragegrid
also, try adding following to S3Client
forcePathStyle(true)
