10 Replies Latest reply on Oct 11, 2016 4:33 PM by mliesegang RSS
    mliesegang Explorer

    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

      • Re: unable to establish MQTT connection to external MQTT broker
        aanjan Heavyweight Champ

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

          • Re: unable to establish MQTT connection to external MQTT broker
            mliesegang Explorer

            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
                aagarwal Explorer

                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
                  fbailleux Apprentice

                  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
                brucehul Apprentice

                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.

                • Re: unable to establish MQTT connection to external MQTT broker
                  mliesegang Explorer

                  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.