7 Replies Latest reply on Mar 28, 2005 3:01 PM by Elias Ross

    Can not publish a MapMessage

    Gabriel Dayley Newbie

      I am having problems publishing a MapMesage with jboss 3.2.5 or higher. When I try to publish the message the following exception is thrown on jboss:

      10:20:29,078 WARN [ClientConsumer] Could not send messages to a receiver.
      java.io.EOFException
      at java.io.ObjectInputStream$BlockDataInputStream.readByte(Unknown Sourc
      e)
      at java.io.ObjectInputStream.readByte(Unknown Source)
      at org.jboss.mq.il.uil2.SocketManager$ReadTask.run(SocketManager.java:27
      9)
      at java.lang.Thread.run(Unknown Source)
      10:20:29,078 ERROR [JMSDestinationManager] The connection to client ID:1 failed.


      However, I can publish a TextMessage or an ObjectMessage just fine. I tried running the same code on 3.2.3 and it worked. Is there a config issue that I am missing?

      Here is the code that is sending the message:

      TopicSession topicSession = null;
      TopicPublisher topicPublisher = null;

      try{
      topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
      topicPublisher = topicSession.createPublisher(topic);

      MapMessage msg = topicSession.createMapMessage();
      msg.setInt("state", state); //0 - On, 1 - Off, 2 - Cycle
      msg.setString("alias", alias);
      topicPublisher.publish(msg);
      }
      catch(Throwable t){
      //JMSException could be thrown
      t.printStackTrace();
      System.err.println("SACPowerControlBean.powerOff: error");
      sc.setRollbackOnly();
      }
      finally{
      if(topicSession != null){
      try{
      topicSession.close();
      }
      catch(JMSException e){
      }
      }
      }


      This is inside a session bean, however I have tried to publish with just a standalone JMS client and recieve the same error.

      Thanks for you help.


        • 1. Re: Can not publish a MapMessage
          Gabriel Dayley Newbie

          Anyone? Ideas?

          • 2. Re: Can not publish a MapMessage
            Kevin Turner Newbie

            I get a ClassCastException when attempting to send a MapMessage to a queue. I'm running JBoss 4.0.0. The same code worked in JBoss 3.2.3.

             MapMessage message = queueSession.createMapMessage();
             for (Iterator iter = messageData.keySet().iterator(); iter.hasNext();)
             {
             String key = (String) iter.next();
             Object value = messageData.get(key);
             message.setObject(key, value);
             }
            
             queueSender.send(message);
            


            The ClassCastException occurs on the "queueSender.send" line. See the stack trace below.

            14:14:34,538 INFO [STDOUT] org.jboss.mq.SpyJMSException: Cannot send a message to the JMS server; - nested throwable: (java.lang.ClassCastException: java.util.HashMap)
            14:14:34,569 INFO [STDOUT] at org.jboss.mq.Connection.sendToServer(Connection.java:1028)
            14:14:34,585 INFO [STDOUT] at org.jboss.mq.SpySession.sendMessage(SpySession.java:1005)
            14:14:34,600 INFO [STDOUT] at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:265)
            14:14:34,616 INFO [STDOUT] at org.jboss.mq.SpyMessageProducer.send(SpyMessageProducer.java:199)
            14:14:34,631 INFO [STDOUT] at com.actek.j2ee.common.process.DefaultJMSConnection.sendMessage(DefaultJMSConnection.java:143)
            


            • 3. Re: Can not publish a MapMessage
              Kevin Turner Newbie

              Apparently, the MapMessage is not compatible with different versions of JBoss. The ClassCastException occurred when sending a MapMessage from JBoss 4.0.0 server to JBoss 3.2.3 server. The error does not occur when sending a MapMessage among JBoss 4.0.0 servers.

              • 4. Re: Can not publish a MapMessage
                Elias Ross Master


                Probably versions 3.2.6+ and 4.0 are serializable compatible.

                • 5. Re: Can not publish a MapMessage
                  Scott Stark Master

                  The jms MapMessage implementation changed between 3.2.3 and 3.2.6 such that its not serializable compatible, but the serialVersionUID was not changed.

                  • 6. Re: Can not publish a MapMessage
                    null null Newbie

                    Unfortunately our environment has a number of JMS clients talking to a 3.2.3 JMS server. We had planned to update SOME of the the JMS clients to 3.2.6 when we experienced this class compatibility problem.

                    My question is can we RELIABLY backport the MQ version in 3.2.3 to the 3.2.6 version? I was able to get our 3.2.6 clients to work by overlaying the 3.2.6 version of server\APP\lib\jboss-mq.jar with the one from 3.2.3. I'm just wondering if anyone else has done this with good results.

                    Thanks in advance.

                    • 7. Re: Can not publish a MapMessage
                      Elias Ross Master


                      I would just overlay the class (MapMessage) itself from 3.2.3 in the 3.2.6 classfile. This would probably the most trouble free. Your milage may vary, however.