Hi

   I am using WebSphere Application Server 6 and configured Default message queue and tested the JNDI entries using dumpNameSpace.

I am using the following code to look up the Connection Factory

Hashtable env=new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL,"iiop://localhost:2809");
InitialContext jndiContext = new InitialContext(env);
>>Object obj=jndiContext.lookup("jms/ConnectionFactory");
ConnectionFactory factory =(ConnectionFactory)PortableRemoteObject.narrow(obj,ConnectionFactory.class);

The line marked as >> above is throwing the following exception

javax.naming.NamingException: Failed to initialize the ORB [Root exception is java.lang.ClassCastException]
    at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:294)
    at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:373)
    at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:112)
    at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:422)
    at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:143)
    at javax.naming.InitialContext.lookup(InitialContext.java:347)
   
Caused by: java.lang.ClassCastException
    at com.ibm.ws.orb.GlobalORBFactory.init(GlobalORBFactory.java:82)
    at com.ibm.ejs.oa.EJSORBImpl.initializeORB(EJSORBImpl.java:174)
    at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:97)
    at com.ibm.ejs.oa.EJSClientORBImpl.<init>(EJSClientORBImpl.java:73)
    at com.ibm.ejs.oa.EJSORB.init(EJSORB.java:386)
    at com.ibm.ws.naming.util.Helpers.getOrb(Helpers.java:285)

Can any body tell, where I am going wrong ? I hope I did not miss out any .jar file in the application /lib.