Reputation: 69
I am trying to connect to elastic search (7.8) securely through Java transport client. I have used x-pack to secure elastic search connectivity. I am not able to create an object of Client due to below error.
2020-08-13 17:43:24 [main] DEBUG XPackSettings:199 - TLSv1.3 is not supported
java.security.NoSuchAlgorithmException: TLSv1.3 SSLContext not available
at sun.security.jca.GetInstance.getInstance(GetInstance.java:159) ~[?:1.8.0_251]
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156) ~[?:1.8.0_251]
at org.elasticsearch.xpack.core.XPackSettings.<clinit>(XPackSettings.java:196) [x-pack-core-7.8.1.jar:7.8.1]
I am using Java 1.8 and supporting jars along with version listed below.
elasticsearch-7.8.0.jar r
elasticsearch-cli-7.8.0.jar
elasticsearch-core-7.8.0.jar
elasticsearch-geo-7.8.0.jar
elasticsearch-nio-7.8.1.jar
elasticsearch-rest-client-7.8.1.jar
elasticsearch-secure-sm-7.8.0.jar
elasticsearch-ssl-config-7.8.1.jar
elasticsearch-x-content-7.8.0.jar
x-pack-core-7.8.1.jar
x-pack-transport-7.8.1-1.0.jar
Connection code that I am using to connect to elastic search through transport port 9300 are below.
Client client = new PreBuiltXPackTransportClient(Settings.builder().put("cluster.name",esClusterName)
.put("node.name", esNodeName)
.put("xpack.security.transport.ssl.enabled", true)
.put("request.headers.X-Found-Cluster",esClusterName)
.put("xpack.security.user", elasticSerachCred)
.put("xpack.security.transport.ssl.key", elasticSearchSSLKeyLocation)
.put("xpack.security.transport.ssl.certificate", elasticSearchSSLCertificateLocation)
.put("client.transport.sniff", false)
.build()).addTransportAddress(new TransportAddress(InetAddress.getByName(transportServerName), transportPort));
elastic search key and certificate I am using same which I have added in elasticsearch.yml file to enable security.
Note:- When I am running this connection code without through tomcat server, connection is working perfectly fine but with tomcat server it is giving this error.
So, I am confuse either I need to do some changes in tomcat side or Is there any elastic search supporting jars version mismatch causing this.
Can anyone guide me here?
Thanks
Upvotes: 1
Views: 1337