Android Question again on MQTT library issue

giggetto71

Active Member
Licensed User
Longtime User
Hi,
I am sorry to re-open this discussion but I keep receiving this error in the google developer still after 4 years. on my devices or emulator I never got one but for some reasons while in the field this issue is triggered.

Exception java.lang.NullPointerException: Attempt to invoke virtual method 'void org.eclipse.paho.client.mqttv3.internal.CommsTokenStore.quiesce(org.eclipse.paho.client.mqttv3.MqttException)' on a null object reference

Based on the below link to me it is crystal clear that they addressed this issue in the 1.2 version of their lib.


NPE when MqttAsyncClient is closed after unsuccessful connect · Issue #194 · eclipse-paho/paho.mqtt.java

Steps to reproduce: Call MqttAsyncClient.connect() Immediately after IMqttActionListener.onFailure() is called, call MqttAsyncClient.close() Issue: MqttAsyncClient.connect() creates the shutdownCon...
github.com

The B4J version of this lib has been updated to 1.25 but apparently it's not possible for Android.
What can we do? there must be a way to update the existing library somehow PLEASE!
 

giggetto71

Active Member
Licensed User
Longtime User
Exception java.lang.NullPointerException: Attempt to invoke virtual method 'void org.eclipse.paho.client.mqttv3.internal.CommsTokenStore.quiesce(org.eclipse.paho.client.mqttv3.MqttException)' on a null object reference
at org.eclipse.paho.client.mqttv3.internal.ClientComms.shutdownConnection (ClientComms.java:310)
at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run (ClientComms.java:608)
at java.lang.Thread.run (Thread.java:1012)


the crash happens in the library so I cannot cath it.
 
Upvote 0

giggetto71

Active Member
Licensed User
Longtime User
I wiill try to explore Application_Error but I don't want to disrupt too much the published version. I believe the crash happens within a service within the app (not the starter, another service). should I use the application_error in that service or the starter service anyway? also I am bit reluctant to get rid of the crashes sent to google play as they are really useful.
In parallel would it be possible for Anywhere SW to evaluate another MQTT client lib? I mean long term I don' t believe remaining on a 10+ years old lib is a good idea anyway. I have see that there are other clients but maybe they are not easy to integrate? no idea.
thanks
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
In parallel would it be possible for Anywhere SW to evaluate another MQTT client lib?
That's definitely a good option. If you find a good candidate of such library then please post it.

Application_Error is only in the starter service and you can choose what to return from that sub based on the error. So only ignore this specific error.
 
Upvote 0

giggetto71

Active Member
Licensed User
Longtime User
how about


it looks stable, maintained and very much supported by a large communiy.
not sure how complex it would be to integrate to B4A.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
Just for clarity @Erel, if I update from jMQTT v1.25 to v1.26, is

B4X:
#PackagerProperty: AdditionalModuleInfoString = provides org.eclipse.paho.client.mqttv3.spi.NetworkModuleFactory with org.eclipse.paho.client.mqttv3.internal.TCPNetworkModuleFactory, org.eclipse.paho.client.mqttv3.internal.SSLNetworkModuleFactory,  org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketNetworkModuleFactory, org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketSecureNetworkModuleFactory;

no longer required if building a standalone package, presumably because you've included the modified org.eclipse.paho.client.mqttv3-1.2.5.jar in the zip.
 
Upvote 0

giggetto71

Active Member
Licensed User
Longtime User
I was reading the release notes of the paho java client and it's very very long list of improvements (most of them I don't even understand..:) so I believe that having this lib up to date it's just great for the entire B4A community using MQTT as we all benefit from years of lib improvements! not to mention that security improvement and that since now we have the compatibility with Android we will stay up to date!
 
Upvote 0

byz

Active Member
Licensed User
1744761282694.png


hi @Erel I downloaded the latest jmqtt but it still shows 1.25 and my project is developed with b4j. And you should also add the following markup.
B4X:
    #PackagerProperty: AdditionalModuleInfoString = provides org.eclipse.paho.client.mqttv3.spi.NetworkModuleFactory with org.eclipse.paho.client.mqttv3.internal.TCPNetworkModuleFactory, org.eclipse.paho.client.mqttv3.internal.SSLNetworkModuleFactory,  org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketNetworkModuleFactory, org.eclipse.paho.client.mqttv3.internal.websocket.WebSocketSecureNetworkModuleFactory;
 
Upvote 0
Top