cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

unable to establish MQTT connection to external MQTT broker

SOLVED
Newbie

unable to establish MQTT connection to external MQTT broker

Hi,

I try to establish a MQTT connection to an external mosquitto MQTT server.

I download the MQTT extension and set it up according the setup instructions.

Nevertheless I got everytime a error message in the application log: Unable to connect to MQTT in [EYMQTT_Testthing] : MqttException

I did a test with MQTT_spy and I got a successful connection.

I´m using thingworx 7.2 and also 6.5 with the latest MQTT extension, but both with no success

I really have no clue what I did wrong ?

Regards

Marco

1 ACCEPTED SOLUTION

Accepted Solutions

Re: unable to establish MQTT connection to external MQTT broker

Hello, In the meantime we understood that the MQTT extension was giving problems under Linux. MQTT extension on Thingworx Server running on Windows does not have any problems.

PTC offered a new MQTT extension begin of October and now the MQTT issue on Linux based Thingworx server is solved.

Solution: Use the latest MQTT extension from the marketplace.

10 REPLIES 10

Re: unable to establish MQTT connection to external MQTT broker

Marco, just to confirm, if you connect to a public server, it connects fine?

Re: unable to establish MQTT connection to external MQTT broker

Hello Aanjan,

setup is the following:

a) Own thingworx server 6.0 (running on hosted server) try to connect to mosquitto MQTT broker on same server

b) Thingworx server 7.2 instance from the vuforia pilot program (running at PTC cloud) try to connect to mosquitto MQTT broker on public root server.

I did the installation of the MQTT extension as described in the support forum.

But in both cases I get the error in the application log: Unable to connect to MQTT in [MQTT_test] : MqttException

A test with MQTT_spy from my laptop to the mosquitto MQTT broker on public root server is working without issues.

Therefore I believe strongly it has something todo with my thingworx extension or thing template setup.

Could it be that there is something to do with the righs in thingworx composer to get the mqtt broker connected ?

Regards

Marco

Re: unable to establish MQTT connection to external MQTT broker

Hello Marco,

I have already tried this Mqtt part of Thingworx and it worked fine. Please check the Configurations of your created thing. I think some problem maybe there. Check the topic name if its same in both the places.

Regards

Anupriya

Re: unable to establish MQTT connection to external MQTT broker

Hi Marco,


Just a test that could help you:
Could you try to had the JAVA_OPTS=”-Duser.dir=/tmp” in the setenv.sh or catalina.sh file depending of your configuration.
I suppose the JAVA_OPTS already exist so just append ”-Duser.dir=/tmp” to it.
Of course /tmp is a folder where user gets all permissions and you can choose whatever folder you want.
After adding this line verify that variable have been correctly exported by setting an echo $JAVA_OPTS.
You need to restart your tomcat server after such modification.


Please let me know if this answer help you.

Regards,

Franck

Re: unable to establish MQTT connection to external MQTT broker

Hello Frank,

I´m not able to check the settings, because the thingworx 7 server is hostd by PTC (part of the vuforia pilot program) and I´m not able to check or even change any web server settings.

I try to contact the vuforia pilot support to see if they can help.

Thanks for your support here.

Re: unable to establish MQTT connection to external MQTT broker

Hello Anupriya,

Does the topic name has to be correct to get a least a connection  to the MQTT server ?

But nevertheless, I did a check on the topic name (seems alright) but problem still exists.

I delete and created the thing several times from scratch but with the same results: Unable to connect to MQTT in [MQTT Test] : MqttException

Re: unable to establish MQTT connection to external MQTT broker

I would assume that the MQTT broker port cannot be reached from the Vuforia Studio Thingworx instance, I guess outbound connections are locked down.

I would recommend that you use the Thingworx Federation concept, so connect to MQTT from a Thingworx instance that can access the broker and then subscribe to the properties of the connected thing from the Vuforia instance via Federation. The two Thingworx instances in Federationa are communicating using the TWX edge protocol on https port which should be open even in the hosted pilot setup.

Highlighted

Re: unable to establish MQTT connection to external MQTT broker

Hi Philipp,

we are running also a separate TWX Server installation on a public root server. Same issue after installation of the MQTT extension on this server.

Even the issue when we are running on this TWX server the mqtt broker mosquitto !?!

Nevertheless, we can try the Federation idea.

Re: unable to establish MQTT connection to external MQTT broker

Is the broker secured or unsecured? If it is secured, then see this post: Securing the Mosquitto MQTT Broker for details about how to make sure the tomcat running Thingworx gets configured to allow for the connection to be made to a secured broker. Note that the post only covers encrypting the traffic to the broker, not the use of client certificates (require_certificate not set to true in the broker configuration). If you self-signed the broker SSL certificate, you won't be able to access the MQTT broker from the Vuforia pilot server as it requires editing the tomcat configuration. You must either use an unsecured or true CA-signed certificate for the Thingworx instance to be allowed to use the broker.

If it is not a secured instance, then can you access the mqtt broker from outside your corporate firewall? The other big issue is getting from the cloud to your mqtt broker port through your firewall. It's not likely to be permitted without help from your IT department.