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 » ClassCastException when retrieving QueueConnectionFactory fr

Post new topic  Reply to topic
 ClassCastException when retrieving QueueConnectionFactory fr « View previous topic :: View next topic » 
Author Message
JustinM
PostPosted: Thu Apr 11, 2002 12:38 am    Post subject: Reply with quote

Novice

Joined: 10 Apr 2002
Posts: 13

Hi

I am getting a ClassCastException when retrieving a QueueConnectionFactory bound to the JNDI tree. The class of the object returned is javax.naming.Reference. The code is as follows:

InitialContext initialContext = new InitialContext(env);
Context jmsContext = (Context)initialContext.lookup("jms");
queueConnectionFactory = (javax.jms.QueueConnectionFactory)jmsContext.lookup("CorrespondenceQCF");

Where env is a hashtable with the following environment variables:
PROVIDER_URL: iiop://localhost:900
INITIAL_CONTEXT_FACTORY:com.ibm.ejs.ns.jndi.CNInitialContextFactory

I have downloaded the latest MA88 pack and installed it.
I have tried using javax.rmi.PortableRemoteObject.narrow() on the object - still a ClassCastException

Any help would be appreciated

Thanks

Justin

Back to top
View user's profile Send private message
abmanesh
PostPosted: Thu Apr 11, 2002 4:58 am    Post subject: Reply with quote

Apprentice

Joined: 06 Nov 2001
Posts: 39

When working with persistent name server you can specify the context name with the provider url itself (iiop://localhost:900/jms ). Then when you obtain the Context try using the instance of InitialDirContext class.

Context jmsContext = new InitialDirContext(env);
Back to top
View user's profile Send private message Send e-mail
JustinM
PostPosted: Thu Apr 11, 2002 5:19 am    Post subject: Reply with quote

Novice

Joined: 10 Apr 2002
Posts: 13

Hi

Thanks for the reply.
I seem to have solved my own problem. For those of you that encounter a similar problem

Check your classpath !

http://216.239.35.100/search?q=cache:6j83QHncIEAC:www-4.ibm.com/software/webservers/appserv/whitepapers/was_mqseries.pdf+Classcastexception+javax.naming.Reference+JMS+lookup&hl=en

Cheers
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 » ClassCastException when retrieving QueueConnectionFactory fr
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.