• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using Connection Factory,I got java.lang.ClassCastException

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use Factory mode,create a factory server and interface,just on method,getDBServer(),return RemoteDBInterface.
public interface FactoryServer extends Remote {
public RemoteDBInterface getDBServer() throws RemoteException;
}
public class FactoryServerImpl extends UnicastRemoteObject implements FactoryServer{
public FactoryServerImpl() throws RemoteException{
super();
}
public RemoteDBInterface getDBServer() throws RemoteException{
System.out.println("New Server create");
RemoteDBServer s = new RemoteDBServer();
return (RemoteDBInterface)s;
}
}
if I run this,
FactoryServer f = (FactoryServer)Naming.lookup("....");//find server ,it's ok
but this statement,
RemoteDBInterface rdb = f.getDBServer();
I get ClassCastException.
Anybody can help me how to solve this?
 
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess you are probably using out dated _Stub files at the client.
 
Jack Yang
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for replying,Sai.I solve it already.
 
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jack Yang:
Thank you for replying,Sai.I solve it already.


I am doing the same thing and I am getting Exception in thread "main" java.lang.AbstractMethodError
at suncertify.client.DataAccessFactory.getConnectionChoice(DataAccessFactory.java:
Can you tell what you did to fix the problem.
[ August 15, 2002: Message edited by: Samual Harvey ]
reply
    Bookmark Topic Watch Topic
  • New Topic