4 Replies Latest reply on Sep 21, 2017 2:58 PM by Thomas Houtekier

    NullpointerException in artemis-server-1.1.0.wildfly-017 and artemis-server-1.5.5.jbossorg-007.jar when using MQTT

    Thomas Houtekier Newbie

      I'm trying to get MQTT working on wildfly-10.1.0.Final.

      I already jumped through a few hoops as explained here: activeMQ-MQTT integration broken in Wildfly-10.1.0.Final?

      When I try to connect to my server using an mqtt-client (such as the chrome-app MQTTBox), there is this error:

      Sep:12,15:57:48,464 WARNING (:Thread-2 (activemq-netty-threads-345981593):) [io.netty.channel.DefaultChannelPipeline] 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.NullPointerException
      at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:391) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:311) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:218) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:204) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:828) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:625) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:358) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:357) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_112]
      Caused by: java.lang.NullPointerException
      at org.apache.activemq.artemis.core.protocol.ProtocolHandler$ProtocolDecoder.decode(ProtocolHandler.java:171) [artemis-server-1.1.0.wildfly-017.jar:]
      at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:360) [netty-all-4.0.33.Final.jar:4.0.33.Final]
      ... 9 more
      

       

      I found the sources here:Index of maven/org/apache/activemq/artemis-server/1.1.0.wildfly-017

      The line generating the NPE is the last line in this snippet:

      ProtocolManager protocolManagerToUse = protocolMap.get(protocolToUse);
      ConnectionCreator channelHandler = nettyAcceptor.createConnectionCreator();
      ChannelPipeline pipeline = ctx.pipeline();
      protocolManagerToUse.addChannelHandlers(pipeline);
      

       

      So, the 'protocolMap' does not contains a manager for MQTT. Eventhough at startup, the logs sais:

      Sep:12,16:05:38,402 INFO  (:ServerService Thread Pool -- 3:) [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-amqp-protocol]. Adding protocol support for: AMQP
      Sep:12,16:05:38,461 INFO  (:ServerService Thread Pool -- 3:) [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-hornetq-protocol]. Adding protocol support for: HORNETQ
      Sep:12,16:05:38,471 INFO  (:ServerService Thread Pool -- 3:) [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-stomp-protocol]. Adding protocol support for: STOMP
      Sep:12,16:05:38,489 INFO  (:ServerService Thread Pool -- 3:) [org.apache.activemq.artemis.core.server] AMQ221043: Protocol module found: [artemis-mqtt-protocol]. Adding protocol support for: MQTT
      (...)
      Sep:12,16:05:41,209 INFO  (:ServerService Thread Pool -- 3:) [org.apache.activemq.artemis.core.server] AMQ221020: Started Acceptor at x.x.x.x:1883 for protocols [MQTT]
      Sep:12,16:05:41,217 INFO  (:ServerService Thread Pool -- 3:) [org.apache.activemq.artemis.core.server] AMQ221007: Server is now live
      Sep:12,16:05:41,219 INFO  (:ServerService Thread Pool -- 3:) [org.apache.activemq.artemis.core.server] AMQ221001: Apache ActiveMQ Artemis Message Broker version 1.1.0.wildfly-017 [nodeID=88159483-97c0-11e7-be7b-53d328deba3f] 
      

      This 'protocolMap' (which should contain support for MQTT) is an constructor-argument, I don't know where it is called from.

      Does anyone have any idea how to enable MQTT for activemq on wilflfy-10.1.0.Final?

      I explained the configuration I'm using in activeMQ-MQTT integration broken in Wildfly-10.1.0.Final?

       

      Message was edited by: Thomas Houtekier I changed the title because the same problem happens with artemis-1.5.5 (in wildfly-10)

        • 1. Re: NullpointerException in artemis-server-1.1.0.wildfly-017 when using MQTT
          Thomas Houtekier Newbie

          The friendly guys from the activeMQ forum noted that the embedded artemis is infact quite old (ActiveMQ - User - wildfly-10.1.0.Final integration for MQTT not working )

          Is it reasonable to assume I can upgrade the bundled artemis to a more recent one? Or will the integration with the rest of wildfly break? I haven't tried yet.

           

          I see that WF11 comes with 1.5.5. Does anyone know if the MQTT support is any better there?

          Thanks

          • 2. Re: NullpointerException in artemis-server-1.1.0.wildfly-017 when using MQTT
            Thomas Houtekier Newbie

            I upgraded artemis (in Wildfly 10) to 1.5.5, which is the latest 1.x version and the one that is packaged in Wildfly-11-RC1.

            I hit the exact same error:

            Sep:13,16:00:23,516 WARNING (:Thread-12 (activemq-netty-threads):) [io.netty.channel.DefaultChannelPipeline] 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.NullPointerException
            at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:442) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:375) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.handler.codec.ByteToMessageDecoder.channelInputClosed(ByteToMessageDecoder.java:342) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:325) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:245) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:231) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.channel.AbstractChannelHandlerContext.fireChannelInactive(AbstractChannelHandlerContext.java:224) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.channel.DefaultChannelPipeline$HeadContext.channelInactive(DefaultChannelPipeline.java:1329) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:245) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.channel.AbstractChannelHandlerContext.invokeChannelInactive(AbstractChannelHandlerContext.java:231) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:908) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.channel.AbstractChannel$AbstractUnsafe$7.run(AbstractChannel.java:744) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasksFrom(SingleThreadEventExecutor.java:379) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.util.concurrent.SingleThreadEventExecutor.confirmShutdown(SingleThreadEventExecutor.java:678) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:452) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_112]
            Caused by: java.lang.NullPointerException
            at org.apache.activemq.artemis.core.protocol.ProtocolHandler$ProtocolDecoder.decode(ProtocolHandler.java:181) [artemis-server-1.5.5.jbossorg-007.jar:1.5.5.jbossorg-007]
            at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:411) [netty-all-4.1.9.Final.jar:4.1.9.Final]
            

             

            I haven't tried, but I assume I will the same problem when would upgrade wildfly to 11?

             

            see also ActiveMQ - User - wildfly-10.1.0.Final integration for MQTT not working

            • 3. Re: NullpointerException in artemis-server-1.1.0.wildfly-017 and artemis-server-1.5.5.jbossorg-007.jar when using MQTT
              Miroslav Novak Master

              Hi Thomas,

               

              I did some search and I think that you hit the same issue as - [ENTMQBR-728] java.lang.NullPointerException occurring in server when using c++ amqp client - JBoss Issue Tracker which is reported against A-MQ 7.0.2 (it's using Artemis 2.x).

               

              I would suggest you to provide reproducer to the jira to help to investigate and resolve this issue. There are some comments that issue might be also environmental which might be worth to check. I also recommend to create jira in Artemis project: ActiveMQ Artemis - ASF JIRA  to point to this issue.

               

              Thanks for your help,

              Mirek