Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ClasCastExc eption looking up ConnectionFactory

 
Chirodip Pal
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

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

While executing the following code.

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);

I am getting the following exception in the Connectionfactory lookup

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 anybody say what is the problem ?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic