| Author |
JMS queue in Websphere 5.0 - Class Cast Exception!
|
dmf fernando
Greenhorn
Joined: Jan 22, 2003
Posts: 2
|
|
We are trying to connect to JMS queue in Websphere 5.0 through a java client and having a problem with casting the lookup Queue Connection factory to the relevant object. 1) get Initial Context : { Hashtable env = new Hashtable(); env.put(Context.PROVIDER_URL,"iiop://test:2809"); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); initialContext = (Context) new InitialContext(env); } 2) After having initial context ,we try to lookup the queue connection Factory (Successfully lookup the and got "obj" ,but failed at Casting obj to QueueConnectionFactory): Code is as follow: import javax.jms.*; .. { Object obj = initialContext.lookup(strConnectionFactory); QueueConnectionFactory Qcf = (QueueConnectionFactory)obj; ////This gives the exception // Qcf = (QueueConnectionFactory)initialContext.lookup(strConnectionFactory); //This ALSO gave the exception //Qcf = (ConnectionFactory) PortableRemoteObject.narrow(obj, javax.jms.QueueConnectionFactory.class); } 3) This is the error message: ERROR [2003-01-22 19:55:47,713](MISMessageProducer.java:109) - java.lang.ClassCastException: javax.naming.Reference Hope someone can help with this.
|
Thanks in advance,<br />mdf
|
 |
Subhash Namboodiri
Ranch Hand
Joined: Jan 02, 2003
Posts: 30
|
|
Hi fernando, A similar problem is already mentioned in this group few days back may be you want to check it out. Anyway for a quick solution just check if 1. namingClient.jar 2. messagingClient.jar 3. naming.jar 4. ecutils.jar ARE present in the CLASSPATH. If all are there in the CLASSPATH it should solve your problem
|
 |
Kyle Brown
author
Ranch Hand
Joined: Aug 10, 2001
Posts: 3879
|
|
And I will say what I said last time. DO NOT, I REPEAT DO NOT LAUNCH A JAVA CLIENT FOR WEBSPHERE IN ANY OTHER WAY OTHER THAN USING LAUNCHCLIENT.BAT!!! USING LAUNCHCLIENT.BAT WILL FIX ALL OF THESE PROBLEMS!! It is the ONLY supported way to run Java clients for WebSphere, the ONLY way! IBM will NOT, I repeat NOT guarantee that it will work any other way! DO NOT GO MESSING WITH YOUR CLASSPATH!!! Kyle
|
Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
|
 |
dmf fernando
Greenhorn
Joined: Jan 22, 2003
Posts: 2
|
|
Thanks for the solutions. We tried with editing the classpaths... and it dind't work. So we will try the LAUNCHCLIENT.BAT and see. Thanks again!
|
 |
 |
|
|
subject: JMS queue in Websphere 5.0 - Class Cast Exception!
|
|
|