Java transport client do not work after upgrade to 6.5.3

We have a Java transport client which worked fine with 6.2 jars on a 6.2 cluster but cannot connect anymore after 6.5.3 upgrade of both client and server.

We did the following

  1. upgrade jars to 6.5.3
  2. recompiled our client
  3. upgraded one node of our cluster in 6.5.3
  4. Run our 6.5.3 client against this 6.5.3 node

We get this:

2018/12/20 16:20:49 678-qes5.1.0-null-TRACE-QESHost_elastic21-sessionClient()	: Nouvelle connexion ...:localhost:9300|
2018/12/20 16:20:49 678-qes5.1.0-null-DEBUG-QESHost_elastic21-connect()	: cluster:elasticsearch|
2018/12/20 16:20:49 678-qes5.1.0-null-DEBUG-QESHost_elastic21-connect()	: host:localhost|
2018/12/20 16:20:49 679-qes5.1.0-null-DEBUG-QESHost_elastic21-connect()	: port:9300|
2018/12/20 16:20:49 679-qes5.1.0-null-DEBUG-QESHost_elastic21-connect()	: Connection avec Xpack|
2018/12/20 16:20:49 679-qes5.1.0-null-DEBUG-QESHost_elastic21-connect()	: Login:elastic|
2018/12/20 16:20:49 679-qes5.1.0-null-DEBUG-QESHost_elastic21-connect()	: Path certificat:/usr/software/conf/elastic-certificates.p12|
2018/12/20 16:20:49 680-qes5.1.0-null-DEBUG-QESHost_elastic21-connect()	: Path authorities:/usr/software/conf/elastic-certificates.p12|
2018/12/20 16:20:49 680-qes5.1.0-null-DEBUG-QESHost_elastic21-connect()	: Avec certificats|
2018/12/20 16:20:50 411-qes5.1.0-null-ERROR-QESHost_elastic21-connect()	: Erreur de connexion:NamedWriteable [org.elasticsearch.cluster.NamedDiff][persistent_tasks] is already registered for [org.elasticsearch.cluster.ClusterModule$$Lambda$777/506775047], cannot register [org.elasticsearch.xpack.core.XPackClientPlugin$$Lambda$784/402207819]|
java.lang.IllegalArgumentException: NamedWriteable [org.elasticsearch.cluster.NamedDiff][persistent_tasks] is already registered for [org.elasticsearch.cluster.ClusterModule$$Lambda$777/506775047], cannot register [org.elasticsearch.xpack.core.XPackClientPlugin$$Lambda$784/402207819]
	at org.elasticsearch.common.io.stream.NamedWriteableRegistry.<init>(NamedWriteableRegistry.java:91)
	at org.elasticsearch.client.transport.TransportClient.buildTemplate(TransportClient.java:163)
	at org.elasticsearch.client.transport.TransportClient.<init>(TransportClient.java:284)
	at org.elasticsearch.transport.client.PreBuiltTransportClient.<init>(PreBuiltTransportClient.java:128)
	at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(PreBuiltXPackTransportClient.java:59)
	at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(PreBuiltXPackTransportClient.java:54)
	at org.elasticsearch.xpack.client.PreBuiltXPackTransportClient.<init>(PreBuiltXPackTransportClient.java:50)
	at com.qwam.qeshost.QESHost_elastic21.connect(QESHost_elastic21.java:157)
	at com.qwam.qeshost.QESHost_elastic21.sessionClient(QESHost_elastic21.java:268)
	at com.qwam.qeshost.QESHost_elastic21.setBase(QESHost_elastic21.java:340)
	at com.qwam.qesutil.qeselasticindex.connectelastic(qeselasticindex.java:194)
	at com.qwam.qesutil.qeselasticindex.main(qeselasticindex.java:1015)
2018/12/20 16:20:50 411-qes5.1.0-null-ERROR-QESHost_elastic21-sessionClient()	: Connexion impossible:null|

Here is our code:

            ses.log(null, "DEBUG", "QESHost_elastic21", "connect()", 3, "Login", login);
            ses.log(null, "DEBUG", "QESHost_elastic21", "connect()", 3, "Path certificat", pathCertificate);
            ses.log(null, "DEBUG", "QESHost_elastic21", "connect()", 3, "Path authorities", pathAuthorities);


            // Connection avec Xpack installe: driver=login|password|path_certificat
            Settings settings = null;

                ses.log(null, "DEBUG", "QESHost_elastic21", "connect()", 3, "Avec certificats");
                settings = Settings.builder()
                    .put("cluster.name", cluster)
                    .put("xpack.security.user", login + ":" + password)
                    .put("xpack.ssl.keystore.path", pathCertificate)
                    .put("xpack.ssl.truststore.path", pathAuthorities)
                    .put("xpack.security.transport.ssl.enabled", "true")
                    .put("xpack.security.transport.ssl.verification_mode", "certificate")
                    .build();


            client = new PreBuiltXPackTransportClient(settings).addTransportAddress(new TransportAddress(InetAddress.getByName(host), port));

Our old 6.2 Java Transport client is still working on this 6.5.3 node. This looks to have something to do with the new jars and the recompilation

Tried to regenerate a new certificate with ...

/usr/software/elasticsearch/bin/elasticsearch-certutil ca

... and use it instead, without success.

I missing something there.......

Upgrading all nodes to 6.5.3 did not help, no connection and the message is still there

I think you have a stale dependency somewhere within your client. In 6.3+, XPackClientPlugin does not try and register a persistent_tasks named writeable, but it did in 6.2.

Hi David,

I had a couple of old x-pack-6.2-XXX.jar in my CLASSPATH and I missed it (the list is becoming very long those days). Sorry for that.

I missed this maven dependency in the upgrade from 6.2 to 6.5

      <dependency>
     <groupId>org.elasticsearch.client</groupId>
     <artifactId>x-pack-transport</artifactId>
          <version>6.5.3</version>
  </dependency>

It is clearly explained here

https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-xpack-client.html

I am afraid it is a RTFM from my side. I apologize for that.
Please close this case.

Thank you David for your help.

1 Like

Not at all. You probably aren't the only person ever to do this, and now that your question is here it will help others in the same situation. Thanks for confirming the fix.

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