Unexpected I/O error while de-serializing auth scheme

I have a simple Java Rest client making an index() call. I am getting warning messages:

IndexRequest<Node> irequest = IndexRequest.of(i -> i
				    .index("index-b")
				    .id("123")
				    .document(node)
				);
		 IndexResponse response = esClient.index(irequest);
2023.08.03 16:14:52 WARNING org.apache.http.impl.client.BasicAuthCache Thread[helidon-server-1,5,server]: Unexpected I/O error while de-serializing auth scheme
java.io.InvalidClassException: filter status: REJECTED
	at java.base/java.io.ObjectInputStream.filterCheck(ObjectInputStream.java:1414)
	at java.base/java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2055)
	at java.base/java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1909)
	at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2235)
	at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1744)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:514)
	at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:472)
	at org.apache.http.impl.client.BasicAuthCache.get(BasicAuthCache.java:130)
	at org.apache.http.client.protocol.RequestAuthCache.process(RequestAuthCache.java:108)
	at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:133)
	at org.apache.http.impl.nio.client.MainClientExec.prepareRequest(MainClientExec.java:520)
	at org.apache.http.impl.nio.client.MainClientExec.prepare(MainClientExec.java:146)
	at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.start(DefaultClientExchangeHandlerImpl.java:129)
	at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.execute(CloseableHttpAsyncClientBase.java:116)
	at org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:138)
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:296)
	at org.elasticsearch.client.RestClient.performRequest(RestClient.java:288)
	at co.elastic.clients.transport.rest_client.RestClientHttpClient.performRequest(RestClientHttpClient.java:91)
	at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:110)
	at co.elastic.clients.elasticsearch.ElasticsearchClient.index(ElasticsearchClient.java:1121)

I have never seen such an error. Could you share a bit more of your code and specifically how you are creating the client?

// Create the low-level client
	RestClient restClient = RestClient
	    .builder(HttpHost.create(serverUrl))
	    .setDefaultHeaders(new Header[]{
	        new BasicHeader("Authorization", "ApiKey " + apiKey)
	    })
	    .build();

// Create the transport with a Jackson mapper
		ElasticsearchTransport transport = new RestClientTransport(
		    restClient, new JacksonJsonpMapper());

		// And create the API client
		ElasticsearchClient esClient = new ElasticsearchClient(transport);

I also tried setting the sslconext but getting the same warning ...

If you want to use API keys, I guess you should use that method: Other authentication methods | Elasticsearch Java API Client [8.9] | Elastic

That's what I used -- constructing a low-level Rest client with a http header of Authorization with Apikey. The Api key is encrypted.

@swallez any idea?

InvalidClassException is a deserialization error, and one of its causes is "The serial version of the class does not match that of the class descriptor read from the stream".

Can you check if you have several versions of the Apache http client library in your classpath?

I only have one version of http client httpclient-4.5.13.jar for my Java client app.

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