Hai all.,
I using the Weblogic Server to deploy my EJB.I deployed a Simple Stateless session bean in that.When i invoke the n=bean from the servlet i am getting ClassCast Exception at the Lookup method. Here is the sample code.
InitialContext ctx = new InitialContext();
Object objRef = ctx.lookup("Order");
CustOrderHome homeCust = (CustOrderHome)PortableRemoteObject.narrow(objRef,CustOrderHome.class);
I am getting the Exception at the Line 2.
Can anybody help ???
Thanks in advance
Sundhar
-
Help - Classcast Exception (1 messages)
- Posted by: Sundhar Chandrasekaran
- Posted on: December 04 2000 08:19 EST
Threaded Messages (1)
- Help - Classcast Exception by VIVEK SHARAN on December 10 2000 05:04 EST
-
Help - Classcast Exception[ Go to top ]
- Posted by: VIVEK SHARAN
- Posted on: December 10 2000 05:04 EST
- in response to Sundhar Chandrasekaran
ctx.lookup wll return ahome object which u need to specifically typecast so try using the following line of code :
InitialContext ctx = new InitialContext();
CustOrderHome homeCust = (CustOrderHome)ctx.lookup("Order");
or
InitialContext ctx = new InitialContext();
Object objRef = (Object)ctx.lookup("Order");
CustOrderHome homeCust = (CustOrderHome)PortableRemoteObject.narrow(objRef,CustOrderHome.class);
or
InitialContext ctx = new InitialContext();
Object objRef = (CustOrderHome)ctx.lookup("Order");
CustOrderHome homeCust = (CustOrderHome)PortableRemoteObject.narrow(objRef,CustOrderHome.class);