• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Getting issue while connecting MQ using JNDI created in WAS

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Getting below error while creating QueueSession:

java.lang.ClassCastException: com.ibm.ejs.jms.JMSSessionHandle incompatible with com.ibm.mq.jms.MQSession

I am using JMS and WAS 7.0 and trying to connect to MQ via JNDI(Queue and Queue manager) created in WAS admin console.


factory = (ConnectionFactory)ctx.lookup("jndi/NewMQManager");
System.out.println("Factory has been looked up-"+factory);

queue = (Queue) ctx.lookup("jms/XMLError");//
System.out.println("Queue Looked Up has been done-"+queue);

qCon= factory.createConnection();
System.out.println("Queue Factory Connection -"+qCon);

QueueSession queueSession =(QueueSession) qCon.createSession(false, Session.AUTO_ACKNOWLEDGE);
 
Rakesh Gupta
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys please respond, I am eagerly waiting for solution......

 
Bartender
Posts: 1150
38
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should post the full stacktrace. Anyway, error you got it's pretty explicit: I think you have imported (and used) the wrong classes. Generally speaking, an appserver runtime may expose more than a single class called "Session", you have to use the right one among various homonyms. Just think about  "Connection" classes: you have JDBC connections, MQ connections and so on.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!