2 Replies Latest reply on Mar 23, 2006 8:43 AM by Melanie Ntolo

    MessageFormatException: IOException: unexpected end of block

    Melanie Ntolo Newbie

      I'm using jboss 3.2.6 and JDK 1.4

      Since I uppgraded to JDK 1.5, my JMS messaging doesn't work anymore.
      I am able to send and receive String messages without any problem but the getObject() method fails for custom objetcs.

      If someone has any idea, please help me.

      This is my Server and Client sourcecode

      Server Code
      QueueSender queueSender = m_queueSession.createSender( m_queue );
      ObjectMessage objectMessage = m_queueSession.createObjectMessage(serialazableObject);
      objectMessage.setStringProperty("Config", selector);
      queueSender.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
      queueSender.send( objectMessage );

      Client code
      public void onMessage( Message message )
      {
      Object obj = null;
      ObjectMessage objectMessage = null;
      try
      {
      if ( message instanceof ObjectMessage )
      {
      objectMessage = ( ObjectMessage ) message;
      obj = objectMessage.getObject();

      if (obj instanceof CLPBRRoute)
      {
      onNewRoute( (CLPBRRoute) obj );
      }
      else if (obj instanceof String)
      {
      onStatusMessage((String)obj);
      }
      }
      }
      catch ( Throwable t )
      {
      }
      }


      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - javax.jms.MessageFormatException: IOException: unexpected end of block data
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - \n
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] -
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - at org.jboss.mq.SpyObjectMessage.getObject(SpyObjectMessage.java:135)
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - \n
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] -
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - at com.calypso.operatorapps.networkdesigner.gui.bestroute.CLPBRResultPanel$CLPBRBestRouteThread.onMessage(CLPBRResultPanel.java:574)
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - \n
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] -
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:680)
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - \n
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] -
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - at java.lang.Thread.run(Thread.java:595)
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] - \n
      Simple listener:Mar-17-2006 17:02:40 - Trace Stderr - [10] -

        • 1. Re: MessageFormatException: IOException: unexpected end of b
          Adrian Brock Master

          It's your object that is getting seriarlized, you tell me.

          • 2. Re: MessageFormatException: IOException: unexpected end of b
            Melanie Ntolo Newbie

            My CLPBRRoute class is serializable and all his components are also serializable with serialVersionUID as you can see in the following class definitions.


            public class CLPBRRoute implements Serializable
            {
            private static long ID_COUNTER=0;
            private CLPBRNode m_start;
            private ArrayList m_cableRouteArcs=new ArrayList();
            private CLPBRRouteElement[] m_fiberRoute = null;
            private CLPBRCost m_cost=null;
            private float m_attenuationWavelength = 0;
            private long m_id=++ID_COUNTER;
            private String m_extremityDescription=null;

            private static final long serialVersionUID = 7487495895819393L;

            }

            public class CLPBRNode
            implements CLPIBRElement, Serializable
            {
            private long m_id = -1;
            private Object m_data;
            private static final long serialVersionUID = 3487485891816293L;
            }

            public class CLPBRArc
            implements CLPIBRElement, Serializable
            {
            private long m_id = -1;
            private int m_number = -1;
            private CLPBRNode m_start = null;
            private CLPBRNode m_end = null;
            private CLPBRCost m_cost = new CLPBRCost();
            private Object m_data;
            private boolean m_used = false;
            private static final long serialVersionUID = 3487485891817293L;
            }

            static class CLPBRRouteElement
            implements Comparable, Serializable
            {
            protected long m_resourceId = -1;
            protected int m_resourceNumber = -1;
            protected long m_typeId = -1;
            protected boolean m_new = false;
            protected CLPBRCost m_cost = new CLPBRCost();

            private static final long serialVersionUID = 3487495895819391L;
            }

            public class CLPBRCost extends HashMap implements Serializable
            {
            private static final long serialVersionUID = 2487495895819393L;
            }