Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic


manju latha
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Iam working with sample stateful session bean
can any body please reply me what could be the problem here in my client code below.
Properties prop = new Properties();
prop.put(Context.SECURITY_PRINCIPAL, "venu");
prop.put(Context.SECURITY_CREDENTIALS, "venuvenu");
Context ctx = new InitialContext(prop);
Object obj = ctx.lookup("banking");
banksfullHome home = (banksfullHome)PortableRemoteObject.narrow(obj,banksfullHome.class);
banksfullRemote br1 = (banksfullRemote)PortableRemoteObject.narrow(home.create(999),banksfullRemote.class);
banksfullRemote br2 = (banksfullRemote)PortableRemoteObject.narrow(home.create(888,"Shiva",3000.00),banksfullRemote.class);


and my Home is
public interface banksfullHome extends EJBHome
public banksfullRemote create(int accNo) throws RemoteException,CreateException;
public banksfullRemote create(int accNo,String accName,double bal)throws RemoteException,CreateException;

iam getting ClassCastException when running client as:
java.lang.ClassCastException at Source)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by manju latha:

You only need to cast (narrow) the references returned by the naming service - i.e. the home interface in your example. When creating the remote beans, you should only need to do this...

Let us know how you get on...
brevity is the soul of wit - shakepeare. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!