Meaningless Drivel is fun!*
The moose likes Websphere and the fly likes ClasCastExc eption looking up ConnectionFactory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Websphere
Bookmark "ClasCastExc eption looking up ConnectionFactory" Watch "ClasCastExc eption looking up ConnectionFactory" New topic
Author

ClasCastExc eption looking up ConnectionFactory

Chirodip Pal
Greenhorn

Joined: Feb 06, 2006
Posts: 1
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 ?
 
GeeCON Prague 2014
 
subject: ClasCastExc eption looking up ConnectionFactory