Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 20942 invoked from network); 30 Apr 2007 20:26:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Apr 2007 20:26:29 -0000 Received: (qmail 7863 invoked by uid 500); 30 Apr 2007 20:26:35 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 7838 invoked by uid 500); 30 Apr 2007 20:26:35 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 7820 invoked by uid 99); 30 Apr 2007 20:26:35 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2007 13:26:35 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of lists@nabble.com designates 72.21.53.35 as permitted sender) Received: from [72.21.53.35] (HELO talk.nabble.com) (72.21.53.35) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Apr 2007 13:26:27 -0700 Received: from [72.21.53.38] (helo=jubjub.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1HicRi-0000at-LW for users@activemq.apache.org; Mon, 30 Apr 2007 13:26:06 -0700 Message-ID: <10260020.post@talk.nabble.com> Date: Mon, 30 Apr 2007 13:26:06 -0700 (PDT) From: nlif To: users@activemq.apache.org Subject: ClassCastException on MessageObject's object MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: naaman@dbnet.co.il X-Virus-Checked: Checked by ClamAV on apache.org Hi all, We have a strange problem, maybe someone has seen this or has an idea: In our MessageListener, we cast the Message into ObejctMessage, and then call getObject() to get the actual object we sent. Upon trying to cast the object to the proper class (SendMobileNotification), we get a ClassCastException. To make things even more strange, this is sporadic: it doesn't always happen, and we can't figure out the exact circumstances under which it does happen. Here is the relevant code: public void onMessage(Message message) { try { ObjectMessage objectMessage = (ObjectMessage) message; Serializable object = objectMessage.getObject(); logger.debug("Message SHOULD BE type: " + SendMobileNotification.class.getName() + " [hashcode=" + SendMobileNotification.class.hashCode() + " , serialVersionUID=" + SendMobileNotification.serialVersionUID + "]"); logger.debug("Message IS type: " + object.getClass().getName() + " [hashcode=" + object.getClass().hashCode() + "]"); SendMobileNotification sendMobileNotification = (SendMobileNotification) (object); // this line throws ClassCastException And here's what's written to the log: DEBUG - Message SHOULD BE type: com.softcom.messages.SendMobileNotification [hashcode=4050691 , serialVersionUID=-11111111111111] DEBUG - Message IS type: com.softcom.messages.SendMobileNotification [hashcode=31922829] Is this an ActiveMQ issue? Is this a class loader issue? If so, how can something like this happen? Is it related to Serialization? Any help will be appreciated. Thanks, Naaman -- View this message in context: http://www.nabble.com/ClassCastException-on-MessageObject%27s-object-tf3671759s2354.html#a10260020 Sent from the ActiveMQ - User mailing list archive at Nabble.com.