• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problme Accessing QueueConnectionFactory in WebSphere 5.0

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am new to WAS , I am unable to get the context of the queue connection factory in WAS 5.0.
Following is the code fragment that I am using.
import javax.jms.*;
import java.io.*;
import java.util.*;
import javax.naming.*;
import javax.rmi.*;
try {
ctx = getInitialContext();
System.out.println("got initial context.......");
Enumeration x = ctx.list("");
for ( ; x.hasMoreElements()
System.out.println(x.nextElement());
}catch (Exception e) {
System.out.println("Error :::::::::::::::::");
e.printStackTrace();
}

try {
System.out.println("2");
queueConnectionFactory = (QueueConnectionFactory) ctx.lookup("rajesh");
System.out.println("3");
queue = (Queue) ctx.lookup("bhoir");
System.out.println("4");
} catch (NamingException e) {
System.out.println("JNDI API lookup failed: " +
e.toString());
System.exit(1);
} catch (Exception e) {
System.out.println(" Exception ::");
e.printStackTrace();
}
When I execute the code .
I am getting the following error
got initial context.......
demo.DemoHome: ejb.demo._DemoHome_Stub
WSsamples: javax.naming.Context
ejb: javax.naming.Context
bhoir: com.ibm.mq.jms.MQQueue
servername: java.lang.String
eis: javax.naming.Context
mail: javax.naming.Context
distributedmap: com.ibm.websphere.cache.DistributedMap
jdbc: javax.naming.Context
plantsby: javax.naming.Context
url: javax.naming.Context
cell: javax.naming.Context
jta: javax.naming.Context
jms: javax.naming.Context
TransactionFactory: com.ibm.ejs.jts.jts.ControlSet$LocalFactory
DefaultDatasource: Default Datasource
rajesh: javax.jms.QueueConnectionFactory
Increment: com.ibm.defaultapplication._EJSRemoteCMPIncrementHome_501bb55e_Stub
Sample: javax.naming.Context
thisNode: javax.naming.Context
2
Exception ::
java.lang.ClassCastException: javax.naming.Reference
at DemoJMS.main(DemoJMS.java:56)
Exception in thread "P=574560 =0:CT" java.lang.NullPointerException
at DemoJMS.main(DemoJMS.java:86)
Can any one tell me what is wrong in this code.
Thanks
Rajesh
 
Let nothing stop you! Not even this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic