0

I am testing my application which uses dynamoDB. I have started an instance locally using docker and I'm able to create / add items in the instance.

Now, inside my Java application, I am trying to connect to my local and when I'm sending an API call that interacts with my local Dynamo, it throws an error -

Unable to execute HTTP request: Unsupported or unrecognised SSL message

I've verified the endpoints and region using commands. Java code snippet for connecting to dynamo -

AmazonDynamoDBClientBuilder builder = AmazonDynamoDBClientBuilder.standard().withCredentials(amazonAWSCredentialsProvider());
    if (StringUtils.isEmpty(endpoint))
        builder.withRegion(Regions.fromName(awsRegion));
    else
        builder.withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, awsRegion));
    return builder.build();

I am not sure where this is failing. I am passing blank for access and secret key, region is the output of aws configure get region. Endpoint is configured to localhost:8000.

Stacktrace -

2021-10-26 17:44:35 [991c4652-5f7f-42ca-8aeb-447b385c535f] ERROR [http-nio-8085-exec-3] o.a.c.c.C.[.[.[.[dispatcherServlet] [DirectJDKLog.java:175] Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.amazonaws.SdkClientException: Unable to execute HTTP request: Unsupported or unrecognized SSL message] with root cause javax.net.ssl.SSLException: Unsupported or unrecognized SSL message at sun.security.ssl.SSLSocketInputRecord.handleUnknownRecord(SSLSocketInputRecord.java:448) at sun.security.ssl.SSLSocketInputRecord.decode(SSLSocketInputRecord.java:184) at sun.security.ssl.SSLTransport.decode(SSLTransport.java:109) at sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1383) at sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1291) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:435) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436) at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384) at com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.connectSocket(SdkTLSSocketFactory.java:142) at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:374) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.amazonaws.http.conn.ClientConnectionManagerFactory$Handler.invoke(ClientConnectionManagerFactory.java:76)

I am also unable to connect to http://localhost:8000/shell although my instance is running.

2
  • Is the Java application inside Docker or is the database inside Docker? Commented Oct 26, 2021 at 8:36
  • Java application is outside, running in a different port. Database is inside docker. Commented Oct 26, 2021 at 11:52

1 Answer 1

4

I got it working. I did not pay attention to the url I used, I should've used http://localhost:8000 (with http://) instead of the pure localhost:8000. Silly mistakes can eat a lot of your time!!

Sign up to request clarification or add additional context in comments.

1 Comment

You saved me so much time!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.