java.lang.IllegalArgumentException:Short string too long;utf-8 encoded length=373,max=255

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ethan__xu/article/details/82623285

看到这个错误的 第一个想法就是发送的消息长度过长,经过上网查找资料基本上没有相关的问题,因为根本不是这个消息太长

第二天跟踪消息原来是因为type的长度超过了255

昨天使用mq发送消息直接报错字符串太长 ,原来是因为BasicProperties bp = new AMQP.BasicProperties.Builder().contentType(CONTENTTYPE).deliveryMode(2).priority(0)
                        .messageId(msgId).correlationId(msgId).replyTo(this.queueName).type(this.msgCode)
                        .contentEncoding(CONTENTENCODING).timestamp(new Date()).build();

messageCode长度超长,传错参数导致.

猜你喜欢

转载自blog.csdn.net/ethan__xu/article/details/82623285