ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » ClassCast exception for QueueConnection.

Post new topic  Reply to topic
 ClassCast exception for QueueConnection. « View previous topic :: View next topic » 
Author Message
ganesh3
PostPosted: Mon Apr 17, 2006 9:04 pm    Post subject: ClassCast exception for QueueConnection. Reply with quote

Apprentice

Joined: 30 Mar 2006
Posts: 35

Hi,
I have a method whose return type is javax.jms.Connection. But when I retrieve it by type casting it in an javax.jms.QueueConnection object in another method, it gives me an ClassCastException. Is it not possible to typecast them. Kindly let me know the same and also is it possible to use the javax.jms.Connection object to create a session?
_________________
Have a Good Day!!!
Back to top
View user's profile Send private message Yahoo Messenger
fjb_saper
PostPosted: Tue Apr 18, 2006 6:26 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Well if you look at the API javax.jms.QueueConnection extends javax.jms.Connection

So what ever you retrieved is not a QueueConnection. Have you thought to check it against javax.jms.TopicConnection ?

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mvic
PostPosted: Wed Apr 19, 2006 1:55 am    Post subject: Re: ClassCast exception for QueueConnection. Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

ganesh3 wrote:
But when I retrieve it by type casting it in an javax.jms.QueueConnection object in another method, it gives me an ClassCastException.

Is "javax.jms.Connection" derived from "javax.jms.QueueConnection"? I think it would have to be so, in order for the cast to work. (This is how it would work in C++ anyway, I think...)

I expect you are allowed to cast in the other direction ie. from the derived class to its parent.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » ClassCast exception for QueueConnection.
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.