Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Paho » Java Paho: ClientId longer than 23 characters
Java Paho: ClientId longer than 23 characters [message #1777861] Tue, 05 December 2017 13:07 Go to next message
Carl Johnson is currently offline Carl JohnsonFriend
Messages: 1
Registered: December 2017
Junior Member
Hey,

i started with Paho one week ago. First of all : good work!

I tried to generate a clientId via this method:

MqttClient.generateClientId()


my exact line of code:

client = new MqttClient(ip, MqttClient.generateClientId());

this was my error:

Exception in thread "main" java.lang.IllegalArgumentException: ClientId longer than 23 characters
at org.eclipse.paho.client.mqttv3.MqttAsyncClient.<init>(MqttAsyncClient.java:257)
at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:222)
at org.eclipse.paho.client.mqttv3.MqttClient.<init>(MqttClient.java:134)
at MQTTMessenger.<init>(MQTTMessenger.java:27)
at SmartFactory.<init>(SmartFactory.java:24)
at SmartFactoryMain.main(SmartFactoryMain.java:5)

Did i do something wrong? Or why is the "generateClientId"-method producing a wrong clientId?

I hope i don't waste ur time.

Have a nice day.

Fine regards,

Carl
Re: Java Paho: ClientId longer than 23 characters [message #1778521 is a reply to message #1777861] Fri, 15 December 2017 15:57 Go to previous message
James Sutton is currently offline James SuttonFriend
Messages: 69
Registered: July 2015
Member
Hi Carl,

What version of the Client are you using? The limit on 23 characters was removed in MQTT 3.1.1, and this check / error in particular was removed back in 2014 (https://github.com/eclipse/paho.mqtt.java/commit/10a54a9fad659ca82dfe87eae7e5d884b6917b33#diff-d6165e482e4450b02a9da12294033054)

I'd suggest upgrading to the latest version of the Paho client, where the Client ID limit is 65535 characters.

The current version is 1.2.0 which can be found on Maven Central here: https://search.maven.org/#artifactdetails%7Corg.eclipse.paho%7Corg.eclipse.paho.client.mqttv3%7C1.2.0%7Ceclipse-plugin
Previous Topic:DexArchiveMergerException on adding paho dependencies to Android project
Next Topic:Python and PKCS11
Goto Forum:
  


Current Time: Wed Sep 19 05:57:21 GMT 2018

Powered by FUDForum. Page generated in 0.02085 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top