• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

JMS queue in Websphere 5.0 - Class Cast Exception!

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 3892
5
Redhat Quarkus Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
dmf fernando
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic