activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: problem in sending messages from CMS to a JMS client.
Date Mon, 03 Nov 2008 16:17:41 GMT
What does the CPP code look like?  

You may want to try using ActiveMQ-CPP 2.2.1, there were some fixes in
the marshaling code that might resolve this.  

Regards
Tim.

On Sun, 2008-11-02 at 02:31 -0800, Brian Woolf wrote:
> 
> my pc:
> 
> activeMQ5.0 
> cms:activemq-cpp-2.1.3
> java SE 5
> windows xp sp2
> 
> 
> this is my code:
> 
> public void onMessage(Message message) {
>     	
>     	System.out.println("Received message: " + message);
>         try {
>         	
>             if (message instanceof TextMessage) {
>                 TextMessage txtMsg = (TextMessage)message;
>                 
>                 if (verbose) {
> 
>                     String msg = txtMsg.getText();
>                     if (msg.length() > 50) {
>                         msg = msg.substring(0, 50) + "...";
>                     }
> 
>                     System.out.println("Received text: " + msg);
>                 }
>             } else if (message instanceof BytesMessage){
>             	BytesMessage bytesMessage=(BytesMessage)message;
>             	
>                 if (verbose) {                
>                     System.out.println("Received byte: " + message);
>                 }
>             }
> 
>             if (message.getJMSReplyTo() != null) {
>                 replyProducer.send(message.getJMSReplyTo(),
> session.createTextMessage("Reply: " + message.getJMSMessageID()));
>             }
> 
>             if (transacted) {
>                 session.commit();
>             } else if ( clientAck ) {
>                 message.acknowledge();
>             }
> 
>         } catch (JMSException e) {
>             System.out.println("Caught: " + e);
>             e.printStackTrace();
>         } finally {
>             if (sleepTime > 0) {
>                 try {
>                     Thread.sleep(sleepTime);
>                 } catch (InterruptedException e) {
>                 }
>             }
>         }
>     }
> 
> Received message: ActiveMQTextMessage {commandId = 5, responseRequired =
> true, messageId = b0b4a930-7e02-4d72-a319-95990ecf4c54:0:0:0,
> originalDestination = null, originalTransactionId = null, producerId =
> b0b4a930-7e02-4d72-a319-95990ecf4c54:0:0, destination = queue://TEST.FOO,
> transactionId = null, expiration = 0, timestamp = 1225619843203, arrival =
> 0, brokerInTime = 1225619843203, brokerOutTime = 1225619843203,
> correlationId = null, replyTo = null, persistent = false, type = null,
> priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null,
> compressed = false, userID = null, content =
> org.apache.activemq.util.ByteSequence@1430b5c, marshalledProperties = null,
> dataStructure = null, redeliveryCounter = 0, size = 0, properties = null,
> readOnlyProperties = true, readOnlyBody = true, droppable = false, text =
> null}
> 
> the error happen:
> 
> javax.jms.JMSException: java.io.UTFDataFormatException
> 	at
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
> 	at
> org.apache.activemq.command.ActiveMQTextMessage.getText(ActiveMQTextMessage.java:90)
> 	at MQServer.onMessage(Unknown Source)
> 	at
> org.apache.activemq.ActiveMQMessageConsumer.dispatch(ActiveMQMessageConsumer.java:946)
> 	at
> org.apache.activemq.ActiveMQSessionExecutor.dispatch(ActiveMQSessionExecutor.java:122)
> 	at
> org.apache.activemq.ActiveMQSessionExecutor.iterate(ActiveMQSessionExecutor.java:192)
> 	at
> org.apache.activemq.thread.PooledTaskRunner.runTask(PooledTaskRunner.java:118)
> 	at
> org.apache.activemq.thread.PooledTaskRunner$1.run(PooledTaskRunner.java:42)
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
> 	at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
> 	at java.lang.Thread.run(Thread.java:595)
> Caused by: java.io.UTFDataFormatException
> 	at
> org.apache.activemq.util.MarshallingSupport.readUTF8(MarshallingSupport.java:372)
> 	at
> org.apache.activemq.command.ActiveMQTextMessage.getText(ActiveMQTextMessage.java:85)
> 


Mime
View raw message