5 Replies Latest reply on Aug 9, 2017 8:49 PM by Justin Bertram

    Exception when trying to connect simple client to artemis wildfly broker

    Aymen Ragoubi Newbie

      I am using apache paho to connect a client to artemis wildfly embeded broker.

      I added mqtt protocol module.

      The client connect to the broker via ""tcp://localhost:61616" port.

      This how I added the mqtt module:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <module xmlns="urn:jboss:module:1.3" name="org.apache.activemq.artemis.protocol.mqtt">

      <resources>

      <resource-root path="artemis-mqtt-protocol-1.1.0.wildfly-017.jar"/>

      <resource-root path="netty-codec-mqtt-5.0.0.Alpha2.jar"/>

       

      </resources>

      <dependencies>

      <module name="org.apache.activemq.artemis"/>

      <module name="org.jboss.logging"/>

      </dependencies>

      </module

       

      When I try to connect my client, I am getting  "An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.: io.netty.handler.codec.DecoderException: java.lang.NoClassDefFoundError: io/netty/channel/ChannelHandler".

       

      I put the full stacktrace as an attachment.

       

      Could someone help me with this ?

        • 1. Re: Exception when trying to connect simple client to artemis wildfly broker
          Justin Bertram Master

          I believe your "org.apache.activemq.artemis.protocol.mqtt" module needs a dependency on the "io.netty" module.

          • 2. Re: Exception when trying to connect simple client to artemis wildfly broker
            Aymen Ragoubi Newbie

            Thank you for your response Justin.
            I added netty-all-4.0.26.Final to my mqtt module.
            This my module.xml with updates:

             

            <?xml version="1.0" encoding="UTF-8"?>

            <module xmlns="urn:jboss:module:1.3" name="org.apache.activemq.artemis.protocol.mqtt">

            <resources>

            <resource-root path="artemis-mqtt-protocol-1.1.0.wildfly-017.jar"/>

            <resource-root path="netty-codec-mqtt-5.0.0.Alpha2.jar"/>

            <resource-root path="netty-all-4.0.26.Final"/>

             

            </resources>

            <dependencies>

            <module name="org.apache.activemq.artemis"/>

            <module name="org.jboss.logging"/>

             

            <module name="javax.api"/>

            <module name="sun.jdk"/>

            <module name="org.javassist" optional="true"/>

             

            </dependencies>

            </module>

             

            Now, when I connect my client I am getting this :

                      WARN  [org.apache.activemq.artemis.core.client] (activemq-failure-check-thread) AMQ212037: Connection failure has been detected: AMQ119014: Did not receive data from /127.0.0.1:53027. It is likely the client has exited or crashed without closing its connection, or the network between the server and client has failed. You also might have configured connection-ttl and client-failure-check-period incorrectly. Please check user manual for more information. The connection will now be closed. [code=CONNECTION_TIMEDOUT]

             

            Could you help me with this ?

            • 3. Re: Exception when trying to connect simple client to artemis wildfly broker
              Justin Bertram Master

              Did you put the netty-all-4.0.26.Final jar file into your module?  I was expecting to see this in your module.xml based on my last recommendation:

               

              <dependencies>

                 ...

                 <module name="io.netty"/>

              </dependencies>

               

              The "AMQ212037: Connection failure has been detected" message you're seeing indicates that a client opened a connection but hasn't communicated with the server within the given timeout and didn't properly close the connection which has forced the broker to close the connection itself.

               

              What behavior are you seeing on the client?

               

              In general I would recommend you use the latest release of Artemis standalone or possibly JBoss AMQ as both of these have bug fixes for MQTT which are not present in the version of Artemis included in Wildfly.

              • 4. Re: Exception when trying to connect simple client to artemis wildfly broker
                Aymen Ragoubi Newbie

                Yes, now I don't get this exception, thank you again for your response.
                But still, I am getting this when I try to connect my client:

                WARN  [org.apache.activemq.artemis.core.protocol.mqtt] (Thread-2 (activemq-netty-threads-164875171)) Error processing Control Packet, Disconnecting ClientAMQ119032: User: null does not have permission='CREATE_DURABLE_QUEUE' on address $sys.mqtt.queue.qos2.JavaSample.

                 

                I added an application user to wildfly, I gave him 'guest' as role, and in my standalone-full.xml, I found this:

                                <security-setting name="#">

                                    <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>

                                </security-setting>

                 

                So I tried to connect my client with username and password (created as an application user in wildfly), but it doesn't work and can not connect to the broker.

                 

                Could you help me with this ?

                • 5. Re: Exception when trying to connect simple client to artemis wildfly broker
                  Justin Bertram Master

                  This is a bug that's already been fixed in Artemis, but not in the version packaged with version of Wildfly you are using.  Again, I would encourage you to use standalone Artemis.