4 Replies Latest reply on Mar 1, 2002 5:34 PM by Chester Chee

    MapMessage.setObject() gives MessageFormatException

    Chester Chee Newbie

      I am writing a simple messaging application, and the data object is nested. e.g. class A has class B.
      I wrote a message converter to translate object of class B to a MapMessage. And same for class A. However, when it translates the message for object of class A, I wrote the following:

      class A ... {

      public static MapMessage translate( Session session, A a ) {
      MapMessage bmsg = BMessageConverter.translate( session, b );
      MapMessage msg = session.createMapMessage();
      :
      :
      :
      msg.setObject( "B", bmsg );
      :
      :
      :
      return msg;
      }
      }

      but when I publish msg that's returned by A.translate( session, a )
      I got a MessageFormatException.

      javax.jms.MessageFormatException: Invalid object type
      at org.jboss.mq.SpyMapMessage.setObject(SpyMapMessage.java:164)

      What am i doing wrong?