Hey all,

I seem to have run into a strange problem, and I'm not sure if it's
ActiveMQ's fault or not. I figured I'd ask if anyone here has heard of it
just in case, though.

So, I am using a BlobMessage to send a large message from a client to a
server. The AMQ instance as well as the process listening to it are both
running on the same server on the OpenJDK Runtime Environment (IcedTea6
1.6.1) (6b16-1.6.1-3ubuntu1), OpenJDK 64-Bit Server VM (build 14.0-b16,
mixed mode). I am sending a BlobMessage by constructing it with an
InputStream. When I send the BlobMessage from a client machine running Sun's
HotSpot JDK (6.0 of course), everything works fine. However, when the
message is sent from a client machine also running OpenJDK (the same version
as the server), the data has a ton (several hundred kilobytes) of NULL
characters appended to the end. It also seems as if EOF isn't being sent
correctly by the client. I'm seeing these characters when I examine the
temporary file in the Jetty server's "data" directory. These extra NULL
characters are breaking the SAX parser we are using later on in the system.

This is how I'm sending the message:

            // Open a session
            ActiveMQSession session = (ActiveMQSession)
this.connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

            // Get ready to send a message to the meta queue
            Destination sendDestination = session.createQueue("myQueue");
            MessageProducer producer =
session.createProducer(sendDestination);
            producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);

            // Set up the receiving temporary queue
            Destination receiveDest = session.createTemporaryQueue();
            MessageConsumer consumer = session.createConsumer(receiveDest);

            // Create the message and add the metadata
            BlobMessage message = session.createBlobMessage(stream); //
            message.setObjectProperty("metadata", meta);

            // Set the reply to the temp queue
            message.setJMSReplyTo(receiveDest);

            String correlationID = createRandomString();
            message.setJMSCorrelationID(correlationID);

            // Finally send the message
            producer.send(message);

And this is how I'm receiving it:

            Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
            Destination listenDestination = session.createQueue("myQueue");
            MessageConsumer consumer =
session.createConsumer(listenDestination);
            MessageProducer replyProducer = session.createProducer(null);
            replyProducer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
            BlobMessage msg = (BlobMessage) consumer.receive();

Has anyone heard of any problems with this in AMQ? Again, I'm not sure that
the issue lies here. However I'm pretty suspicious of it since the data is
corrupted once it is turned into a jetty temporary file.

*** We are using ActiveMQ 5.3.0, and again, the JDK on which the problem is
occurring has a version string of OpenJDK Runtime Environment (IcedTea6
1.6.1) (6b16-1.6.1-3ubuntu1), OpenJDK 64-Bit Server VM (build 14.0-b16,
mixed mode). ***

Thanks!
Marc Weil

Reply via email to