Posted: Mon Apr 17, 2006 9:04 pm Post subject: ClassCast exception for QueueConnection.
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!!!
Posted: Wed Apr 19, 2006 1:55 am Post subject: Re: ClassCast exception for QueueConnection.
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.
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