尝试使用
val nullablestr = hornetQMessage.getBodyBuffer.readNullableSimpleString.toString
或
val strMessage = hornetQMessage.getBodyBuffer.readString
获得
java.lang.NegativeArraySizeException 在org.hornetq.core.buffers.impl.ChannelBufferWrapper.readSimpleStringInternal(ChannelBufferWrapper.java:83) 在org.hornetq.core.buffers.impl.ChannelBufferWrapper.readNullableSimpleString(ChannelBufferWrapper.java:58) 在com.gamescale.messaging.hornetQ.HornetQMessageConverter $ .extractGSMessage(HornetQMessageConverter.scala:68) 在com.gamescale.messaging.hornetQ.MessageBusHornetQClientImpl $$ anonfun $ 1 $$ anon $ 2 $$ anonfun $ receive $ 1.apply(MessageBusHornetQClientImpl.scala:246) 在com.gamescale.messaging.hornetQ.MessageBusHornetQClientImpl $$ anonfun $ 1 $$ anon $ 2 $$ anonfun $ receive $ 1.apply(MessageBusHornetQClientImpl.scala:243) at akka.actor.Actor $ class.apply(Actor.scala:563) 在com.gamescale.messaging.hornetQ.MessageBusHornetQClientImpl $$ anonfun $ 1 $$ anon $ 2.apply(MessageBusHornetQClientImpl.scala:242) at akka.actor.LocalActorRef.invoke(ActorRef.scala:905) at akka.dispatch.MessageInvocation.invoke(MessageHandling.scala:25) at akka.dispatch.ExecutableMailbox $ class.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:216) at akka.dispatch.ExecutorBasedEventDrivenDispatcher $$ anon $ 4.processMailbox(ExecutorBasedEventDrivenDispatcher.scala:122) at akka.dispatch.ExecutableMailbox $ class.run(ExecutorBasedEventDrivenDispatcher.scala:188) at akka.dispatch.ExecutorBasedEventDrivenDispatcher $$ anon $ 4.run(ExecutorBasedEventDrivenDispatcher.scala:122) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615) 在java.lang.Thread.run(Thread.java:722) at akka.dispatch.MonitorableThread.run(ThreadPoolBuilder.scala:184)
我使用相同的方法来编写消息
hornetQMessage.getBodyBuffer.writeString(message)
任何想法?
答案 0 :(得分:1)
作为任何HornetQ用户的参考。 cause of this bug was determined at the HornetQ forum。
简而言之,它是由错误顺序从缓冲区读取值引起的。比如,你在写字符串之前写了一个负整数,然后在另一边,你尝试读取字符串而不先读取负整数。