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