4 Replies Latest reply on Dec 17, 2001 7:06 AM by Mark

    Message size limit?

    Mike Squance Newbie


      I'm finding that if I try to publish a TextMessage with 65536 or more characters, I get the following exception:

      org.jboss.mq.SpyJMSException: Cannot send a message to the JMS server

      This is with JBoss 2.4.1. I'm fairly certain I was able to send larger messages in previous versions.

      Is this the intent? My guess is that the message size is being stored in a 16-bit number instead of something larger or something along those lines.


        • 1. Re: Message size limit?
          Christian Riege Newbie

          this is a known issue with JBossMQ bundled with the 2.4.x release. the "bug" here is that SUN's readUTF() / writeUTF() methods used to read/write a TextMessage support a maximum of 65535 bytes (64kb). it's fixed in CVS HEAD (i.e the upcoming 3.0 release) but from what I gather the fix will not be backported because it breaks message compatibility in between 2.4.x releases.

          if you want to fix this, get JBoss 2.4 from CVS (Branch_2_4 is the tag to use) and replace SpyTextMessage.java with the current file from CVS HEAD (you can get that version by browsing the CVS tree on SourceForge, no need to check out the whole beast). Recompile and TextMessages > 64kb will start to work.

          • 2. Re: Message size limit?
            Jonathan Li Newbie

            What about object message? Is there any size limitation to object message?

            Mind to tell me how to implement the big size messages?

            • 3. Re: Message size limit?
              Mike Squance Newbie

              Thanks, that solved the problem.


              • 4. Re: Message size limit?
                Mark Newbie

                I ran into the same problem, so it was good to hear this was a known issue.

                Since I didn't feel like taking just a single file with the fix in it and rebuild JBoss with it, I used a StreamMessage instead. I first write the message-size and then the text-message as an array of byte with the writeBytes() method. This works with arrays larger than 64K as well and doesn't require me to touch JBoss at all. And I'll need to change just a few lines back when the fix makes it in a stable release.