Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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: 1264
39
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.
 
Well THAT's new! Comfort me, reliable tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic