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.
Advertisement
Answer
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!!