Moquette and Greengrass NullPointerException

0

When subscribing to the MQTT on a Greengrass V2 core device running Moquette version 2.2.0 and I'm trying to subscribe from a device client I see this error in the logs:

Caused by: java.lang.NullPointerException
	at io.moquette.broker.PostOffice.subscribeClientToTopics(PostOffice.java:236)
	at io.moquette.broker.MQTTConnection.lambda$processSubscribe$6(MQTTConnection.java:402)
	at io.moquette.broker.SessionCommand.execute(SessionCommand.java:23)
	at io.moquette.broker.PostOffice.lambda$routeCommand$5(PostOffice.java:635)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

It seems there may be a bug with this implementation as shown https://github.com/moquette-io/moquette/issues/473. That issue describes a setting named "cleanSession" that can be tried but it does not seem to be an option as documented https://github.com/moquette-io/moquette/blob/main/distribution/src/main/resources/moquette.conf. Is there a workaround for this? I've tried switching over to the **aws.greengrass.clientdevices.mqtt.EMQX ** broker instead but I can't seem to get that one to deploy. During deployment I get the following error:

FAILED_NO_STATE_CHANGE: NoAvailableComponentVersionException: No local or cloud component version satisfies the requirements. Check whether the version constraints conflict and that the component exists in your AWS account with a version that matches the version constraints. If the version constraints conflict, revise deployments to resolve the conflict. Component aws.greengrass.clientdevices.mqtt.EMQX version constraints: thinggroup/GreengrassPIDevices requires =1.0.0.

According to the component it requires the following:

aws.greengrass.clientdevices.Auth	>=2.2.0 <2.3.0

and I have version 2.2.0 installed on my core device.

I'm looking for suggestions on how to get around this issue. Thanks.

asked 2 years ago342 views
2 Answers
0

Hello,

First for Moquette, cleanSession is an option which you set in your MQTT client when connecting to the MQTT broker. Review your MQTT client's documentation for setting cleanSession to false or 0.

EMQX is available for Windows on x64 CPUs and on Linux for x64 and arm aarch64 CPUs. Given the error message that you received, it is most likely that you are using Linux on armv7 which is not one of the supported platforms for EMQX.

AWS
EXPERT
answered 2 years ago
  • Thanks. I'm using the arduino-aws-greengrass-iot api so I'll grep their code to see where I can set that.

0

Hi Al,

The Moquette bug you linked is very old and likely doesn't apply anymore. I'll ping the maintainer to close it.

Can you provide complete logs leading up to that NPE along with specific steps to reproduce? This is the line throwing the exception. It indicates that there is no MQTT session with the provided client ID, which would suggest your client is getting disconnected at some point after subscribing. We need more context to dig in further.

Consider opening an issue with us in Github.

Also, if you haven't already, take a look at our developer guide for setting up client devices.

Thanks, -joe

AWS
answered 2 years ago
  • FWIW - one common cause of disconnects is due to duplicate client IDs. This occurs when two clients connect using the same MQTT client ID. This would be a bug in your client side code -- take a look to see if this might be happening.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions