# Exception caught on transport layer (es6.4.2)

**URL:** <https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-security\
**Created:** [January 11, 2019, 3:51pm UTC](https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924 "2019-01-11T15:51:37Z")\
**Posts on this page:** 7\
**Page:** 3

<div class="post-metadata">

**Author:** ![aparent](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@aparent](https://discuss.elastic.co/u/aparent)\
**Post date:** [January 17, 2019, 9:59am UTC](https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924/42 "2019-01-17T09:59:24Z")

</div>

Here is my code if you want to give it a try :

```
public static void main(String[] args) throws Exception{
        Settings settings = org.elasticsearch.common.settings.Settings.builder()
                .put("cluster.name", "elastic_cluster6")
                .put("xpack.security.user", "antoine:password")
                .put("xpack.security.transport.ssl.enabled", "true")
                .put("xpack.security.transport.ssl.keystore.path", "/Users/aparent/Downloads/es6.p12")
                .put("xpack.security.transport.ssl.keystore.password", "password")
                .put("xpack.security.transport.ssl.truststore.path", "/Users/aparent/Downloads/es6.p12")
                .put("xpack.security.transport.ssl.truststore.password", "password")
                .put("xpack.security.transport.ssl.verification_mode", "certificate")
                .build();

        TransportClient transportClient = new PreBuiltXPackTransportClient(settings);
        transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName("xx.xx.xx.xx"), 9302));
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();

        
        SearchModule searchModule = new SearchModule(settings, true, Collections.<SearchPlugin> emptyList());
		
		try (XContentParser parser = XContentFactory.xContent(XContentType.JSON)
				.createParser(new NamedXContentRegistry(searchModule.getNamedXContents()), DeprecationHandler.THROW_UNSUPPORTED_OPERATION, "{ \"query\": {\"match_all\": {} }}")) {
	
					searchSourceBuilder.parseXContent(parser);
				}
		SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(transportClient, SearchAction.INSTANCE)
		.setTypes("tables")
		.addSort(org.elasticsearch.search.sort.FieldSortBuilder.DOC_FIELD_NAME, org.elasticsearch.search.sort.SortOrder.ASC)
		.setScroll(new org.elasticsearch.common.unit.TimeValue(1000))
		.setSearchType(org.elasticsearch.action.search.SearchType.DEFAULT);
		org.elasticsearch.action.search.SearchResponse searchResponse = searchRequestBuilder.setSource(searchSourceBuilder).execute().actionGet();

		while (true) {
			for (SearchHit searchHit : searchResponse.getHits().getHits()) {
				System.out.println(searchHit.toString());
			}
		}
    }

```

I keep getting the same error `not an SSL/TLS record`.

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [January 17, 2019, 10:25am UTC](https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924/43 "2019-01-17T10:25:27Z")

</div>

I changed only the `keystore.path` and `truststore.path` to point to my file and `xx.xx.xx.xx` to localhost as I run my Elasticsearch node locally and this works fine.

---

<div class="post-metadata">

**Author:** ![aparent](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@aparent](https://discuss.elastic.co/u/aparent)\
**Post date:** [January 17, 2019, 10:27am UTC](https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924/44 "2019-01-17T10:27:40Z")

</div>

You actually have something printed on your console ?

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [January 17, 2019, 10:31am UTC](https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924/45 "2019-01-17T10:31:04Z")

</div>

This is actually irrelevant, but yes. I don't have the same data as you do in my node so I had to adjust `.setTypes("table")` to `.setTypes("doc")` but this is not about troubleshooting the search queries.

The request was sent over TLS and there were no errors in my elasticsearch logs ( especially not an `not an SSL/TLS record.` one)

---

<div class="post-metadata">

**Author:** ![aparent](https://avatars.discourse-cdn.com/v4/letter/a/9de0a6/32.png) [@aparent](https://discuss.elastic.co/u/aparent)\
**Post date:** [January 17, 2019, 10:51am UTC](https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924/46 "2019-01-17T10:51:31Z")

</div>

Ok, then it could be network related I guess ...  
Thank you for everything ! 🙂

---

<div class="post-metadata">

**Author:** ![ikakavas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ikakavas/32/34430_2.png) [@ikakavas](https://discuss.elastic.co/u/ikakavas)\
**Post date:** [January 17, 2019, 10:59am UTC](https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924/47 "2019-01-17T10:59:33Z")

</div>

No problem ! As I said earlier though, this is strange symptom for it to be caused by a network problem unless you have something like a reverse proxy terminating SSL in front of Elatsticsearch and your `xx.xx.xx.xx` is not the IP Address of the Elasticsearch node but rather that of your proxy. I guess you would know that already.

You can always enable [the audit logging](https://www.elastic.co/guide/en/elastic-stack-overview/6.4/auditing.html) and check the [`origin_address`](https://www.elastic.co/guide/en/elastic-stack-overview/6.4/audit-event-types.html) and verify that this is the IP address of your machine were you run the Transport Client or an intermediate proxy.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 14, 2019, 10:59am UTC](https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924/48 "2019-02-14T10:59:38Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.

[Previous page](https://discuss.elastic.co/t/exception-caught-on-transport-layer-es6-4-2/163924.md?page=2)
