This is a discussion on java.lang.ClassCastException: javax.naming.Reference - Weblogic ; Hi: I find several questions on the same topic but no solutions. I am trying to create a stand-alone client to Websphere MQ JMS using the following simple code: Hashtable h = new Hashtable(); h.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory"); //h.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory"); h.put(Context.PROVIDER_URL,"iiop://localhost:2809"); Context context = ...
Hi:
I find several questions on the same topic but no solutions.
I am trying to create a stand-alone client to Websphere MQ JMS using
the following simple code:
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
//h.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
h.put(Context.PROVIDER_URL,"iiop://localhost:2809");
Context context = new InitialContext(h);
System.out.println("Initial Context obtained");
Object o = context.lookup("jms/qcf");
System.out.println("QueueConnectionFactory obtained as object");
System.out.println(o.getClass().getName());
System.out.println(o.toString());
QueueConnectionFactory qcf =
(QueueConnectionFactory)context.lookup("jms/qcf");
and it fails while casting to QueueConnectionFactory (context is
fine).
I include all the required JARS from base_v5/lib and
base_v5/mqjms/java/lib and the implFactory.jar from
wstools/eclipse/plugin folder and the java/javac from
base_v5\java\bin.
Any help would be much appreciated.