From dev-return-20957-apmail-activemq-dev-archive=activemq.apache.org@activemq.apache.org Fri Jul 02 10:56:58 2010 Return-Path: Delivered-To: apmail-activemq-dev-archive@www.apache.org Received: (qmail 5334 invoked from network); 2 Jul 2010 10:56:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Jul 2010 10:56:58 -0000 Received: (qmail 5811 invoked by uid 500); 2 Jul 2010 10:56:58 -0000 Delivered-To: apmail-activemq-dev-archive@activemq.apache.org Received: (qmail 5651 invoked by uid 500); 2 Jul 2010 10:56:55 -0000 Mailing-List: contact dev-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list dev@activemq.apache.org Received: (qmail 5643 invoked by uid 99); 2 Jul 2010 10:56:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jul 2010 10:56:55 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of chubrilo@gmail.com designates 209.85.214.171 as permitted sender) Received: from [209.85.214.171] (HELO mail-iw0-f171.google.com) (209.85.214.171) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Jul 2010 10:56:49 +0000 Received: by iwn41 with SMTP id 41so2844083iwn.2 for ; Fri, 02 Jul 2010 03:56:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type:content-transfer-encoding; bh=RCA/1LYEiMDU1fhtesreBYlNv7ZVK2uTjjcijk6h+qc=; b=wNPumaajEywag7xYy6CUUgIafu78as53GSLMGlVFUcJ2AGss0RCtPK/z111V34TeNb X9m+u5vpvyGZMPkeb0LNXW97wdiVafxUF5x2AOZa3i3vMchNpFhUkamK1rKfiBaFq3w7 D8WBclswHHrQe/DFrZV96w2Qr+qDFVHqe/OH4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; b=r67vyo4tanTu6ew5dDxxFZR32TngKuq7wFApcHY/ymTXIHMx7dob6jB/Mfm4o+GSjc 5lwITDqeLrn3B6yB75cQ7DAfeV52BEbyEYMEww/B/QyZXfJxqNpdWFHFiDVNwaT9ickP snhTbgQdh1HOP7UFXQafSXMFQ8MWuYiCZWJl8= MIME-Version: 1.0 Received: by 10.42.4.75 with SMTP id 11mr198090icr.50.1278068188266; Fri, 02 Jul 2010 03:56:28 -0700 (PDT) Sender: chubrilo@gmail.com Received: by 10.42.2.138 with HTTP; Fri, 2 Jul 2010 03:56:28 -0700 (PDT) In-Reply-To: <29054743.post@talk.nabble.com> References: <29054743.post@talk.nabble.com> Date: Fri, 2 Jul 2010 12:56:28 +0200 X-Google-Sender-Auth: g0lIG265LK5tXxUzVPMeYaO53gk Message-ID: Subject: Re: ClassCastException From: Dejan Bosanac To: dev@activemq.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Hi, make sure you get javax.jms.Message in your onMessage() method, by either importing it or using using it explicitly in the param definition. Cheers -- Dejan Bosanac - http://twitter.com/dejanb Open Source Integration - http://fusesource.com/ ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net On Fri, Jul 2, 2010 at 12:25 PM, lernit2007 wrote: > > Hello, > > I have a following interface: > > public interface Test extends Message { > > public void testMessage(); > > public void getString(); > > } > > If I get a Message I want to cast the Message in Test: > > public void onMessage(Message message) { > =A0 Test test =3D (Test) message; > > } > > But I get the following Exception: > > java.lang.ClassCastException: > org.apache.activemq.command.ActiveMQTextMessage cannot be cast to Test. > > Can you help me further please? I don't know, what the problem is. > -- > View this message in context: http://old.nabble.com/ClassCastException-tp= 29054743p29054743.html > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com. > >