org.springframework.messaging.MessageHandlingException: error occurred in message handler [mqttOutboundHandler]; nested exception is java.lang.IllegalArgumentException: The topic name MUST NOT contain any wildcard characters (#+)

Spring JIRA | Anton | 12 months ago
  1. 0

    Details: Mqtt broker: apache apollo 1.7 Mqtt eclipse paho client There is some logic on our server that constructs outbound (response) topic name based on incoming message topic name. The logic is pretty straightforward. Client sends message to the topic name {{path/<device-id>/<sub-device-id>/outbound}} and gets server echo message on {{path/<device-id>/<sub-device-id>/inbound}} topic. We didn't implement any topic validation logic on server side yet and this causes the next issue: When some device (not in our control) sends message to the topic name {{path/\+/\+/outbound}} (which is wrong topic name format) server constructs the next topic name for the response message: {{path/\+/\+/inbound}}. The topic name to send message is obviously invalid and after _multiple attempts_ to send message to this topic name system hangs at {{MqttPahoMessageDrivenChannelAdapter}} with the message "Attempting reconnect". The log contains the following exceptions + {{MqttPahoMessageDrivenChannelAdapter}} becomes running in the loop trying to re-connect to mqtt broker: {noformat} org.springframework.messaging.MessageHandlingException: error occurred in message handler [mqttOutboundHandler]; nested exception is java.lang.IllegalArgumentException: The topic name MUST NOT contain any wildcard characters (#+) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:139) at org.springframework.integration.config.annotation.ServiceActivatorAnnotationPostProcessor$ReplyProducingMessageHandlerWrapper.handleRequestMessage(ServiceActivatorAnnotationPostProcessor.java:99) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:99) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127) ................ org.eclipse.paho.client.mqttv3.MqttException: Client is connected at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.connect(MqttAsyncClient.java:465) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.connect(MqttAsyncClient.java:455) at org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter.connectAndSubscribe(MqttPahoMessageDrivenChannelAdapter.java:194) at org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter.access$300(MqttPahoMessageDrivenChannelAdapter.java:41) at org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter$1.run(MqttPahoMessageDrivenChannelAdapter.java:237) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 2015-12-21 16:02:28.362 DEBUG 65151 --- [task-scheduler-1] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:28.364 DEBUG 65151 --- [task-scheduler-4] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:33.697 DEBUG 65151 --- [task-scheduler-8] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:37.898 DEBUG 65151 --- [task-scheduler-6] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:37.900 DEBUG 65151 --- [task-scheduler-9] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:37.921 DEBUG 65151 --- [task-scheduler-2] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:38.024 DEBUG 65151 --- [task-scheduler-7] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect ............... {noformat} indefinitely trying to reconnect. We can definitely fix this issue on our server side to validate topic names but there is still open question why {{MqttPahoMessageDrivenChannelAdapter}} : Attempting reconnect appears on paho {{java.lang.IllegalArgumentException: The topic name MUST NOT contain any wildcard characters (#+)}} in general? And more important question why channel adapter hangs on attempts to reconnect?

    Spring JIRA | 12 months ago | Anton
    org.springframework.messaging.MessageHandlingException: error occurred in message handler [mqttOutboundHandler]; nested exception is java.lang.IllegalArgumentException: The topic name MUST NOT contain any wildcard characters (#+)
  2. 0

    Details: Mqtt broker: apache apollo 1.7 Mqtt eclipse paho client There is some logic on our server that constructs outbound (response) topic name based on incoming message topic name. The logic is pretty straightforward. Client sends message to the topic name {{path/<device-id>/<sub-device-id>/outbound}} and gets server echo message on {{path/<device-id>/<sub-device-id>/inbound}} topic. We didn't implement any topic validation logic on server side yet and this causes the next issue: When some device (not in our control) sends message to the topic name {{path/\+/\+/outbound}} (which is wrong topic name format) server constructs the next topic name for the response message: {{path/\+/\+/inbound}}. The topic name to send message is obviously invalid and after _multiple attempts_ to send message to this topic name system hangs at {{MqttPahoMessageDrivenChannelAdapter}} with the message "Attempting reconnect". The log contains the following exceptions + {{MqttPahoMessageDrivenChannelAdapter}} becomes running in the loop trying to re-connect to mqtt broker: {noformat} org.springframework.messaging.MessageHandlingException: error occurred in message handler [mqttOutboundHandler]; nested exception is java.lang.IllegalArgumentException: The topic name MUST NOT contain any wildcard characters (#+) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:139) at org.springframework.integration.config.annotation.ServiceActivatorAnnotationPostProcessor$ReplyProducingMessageHandlerWrapper.handleRequestMessage(ServiceActivatorAnnotationPostProcessor.java:99) at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:99) at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127) ................ org.eclipse.paho.client.mqttv3.MqttException: Client is connected at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:31) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.connect(MqttAsyncClient.java:465) at org.eclipse.paho.client.mqttv3.MqttAsyncClient.connect(MqttAsyncClient.java:455) at org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter.connectAndSubscribe(MqttPahoMessageDrivenChannelAdapter.java:194) at org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter.access$300(MqttPahoMessageDrivenChannelAdapter.java:41) at org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter$1.run(MqttPahoMessageDrivenChannelAdapter.java:237) at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 2015-12-21 16:02:28.362 DEBUG 65151 --- [task-scheduler-1] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:28.364 DEBUG 65151 --- [task-scheduler-4] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:33.697 DEBUG 65151 --- [task-scheduler-8] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:37.898 DEBUG 65151 --- [task-scheduler-6] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:37.900 DEBUG 65151 --- [task-scheduler-9] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:37.921 DEBUG 65151 --- [task-scheduler-2] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect 2015-12-21 16:02:38.024 DEBUG 65151 --- [task-scheduler-7] .m.i.MqttPahoMessageDrivenChannelAdapter : Attempting reconnect ............... {noformat} indefinitely trying to reconnect. We can definitely fix this issue on our server side to validate topic names but there is still open question why {{MqttPahoMessageDrivenChannelAdapter}} : Attempting reconnect appears on paho {{java.lang.IllegalArgumentException: The topic name MUST NOT contain any wildcard characters (#+)}} in general? And more important question why channel adapter hangs on attempts to reconnect?

    Spring JIRA | 12 months ago | Anton
    org.springframework.messaging.MessageHandlingException: error occurred in message handler [mqttOutboundHandler]; nested exception is java.lang.IllegalArgumentException: The topic name MUST NOT contain any wildcard characters (#+)
  3. 0

    Spring integration: how to handle exceptions in services after an aggregator?

    Stack Overflow | 2 years ago | Nicolas
    org.springframework.messaging.MessageHandlingException: java.lang.Exception: ahahaha
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 40#149338851

    GitHub | 1 year ago | trisberg
    org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.redis.outbound.RedisQueueOutboundChannelAdapter@2693ec5f]; nested exception is java.lang.IllegalArgumentException: EvaluationContext must not be null
  6. 0

    GitHub comment 22#146518952

    GitHub | 1 year ago | ericbottard
    org.springframework.messaging.MessageHandlingException: error occurred in message handler [org.springframework.integration.redis.outbound.RedisQueueOutboundChannelAdapter@57b9c7a3]; nested exception is java.lang.IllegalArgumentException: EvaluationContext must not be null

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.springframework.messaging.MessageHandlingException

      error occurred in message handler [mqttOutboundHandler]; nested exception is java.lang.IllegalArgumentException: The topic name MUST NOT contain any wildcard characters (#+)

      at org.springframework.integration.handler.AbstractMessageHandler.handleMessage()
    2. Spring Integration Core
      AbstractMessageHandler.handleMessage
      1. org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:139)
      2. org.springframework.integration.config.annotation.ServiceActivatorAnnotationPostProcessor$ReplyProducingMessageHandlerWrapper.handleRequestMessage(ServiceActivatorAnnotationPostProcessor.java:99)
      3. org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:99)
      4. org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
      4 frames