Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

distributed banking code , getting error : _stub class cannot be casted!!!

 
Smriti Awasthi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Can anybody help me with this error.
I created a ditributed banking system, which is a code for atm machine. The client first connects to atm and atm connects with bank to do all operations like deposit, withdraw, balance and does security checking also.

I have rmiregistry ON. My bankserver and security service run on first cmd window and atmserver on second cmd window. I get the message that bankserver is bound to rmiregistry, security is also bound and atm server also bound to rmiregistry.

On third window, i started the client.

But when i run it, I get the following error:

java.lang.ClassCastException: cscie160.project.AccountImpl_Stub cannot be cast
o cscie160.project.AccountImpl
at cscie160.project.ATMImpl.getBalance(ATMImpl.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown So
rce)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sou
ce)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Sourc
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unkno
n Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at cscie160.project.ATMImpl_Stub.getBalance(Unknown Source)
at cscie160.project.Client.printBalances(Client.java:68)
at cscie160.project.Client.testATM(Client.java:53)
at cscie160.project.Client.main(Client.java:35)
Failed as expected: java.lang.ClassCastException: cscie160.project.AccountImpl_
tub cannot be cast to cscie160.project.AccountImpl
Failed as expected: java.lang.ClassCastException: cscie160.project.AccountImpl_
tub cannot be cast to cscie160.project.AccountImpl
Failed as expected: java.lang.ClassCastException: cscie160.project.AccountImpl_
tub cannot be cast to cscie160.project.AccountImpl
Unexpected error: java.lang.ClassCastException: cscie160.project.AccountImpl_St
b cannot be cast to cscie160.project.AccountImpl
Unexpected error: java.lang.ClassCastException: cscie160.project.AccountImpl_St
b cannot be cast to cscie160.project.AccountImpl
Unexpected error: java.lang.ClassCastException: cscie160.project.AccountImpl_St
b cannot be cast to cscie160.project.AccountImpl
Unexpected error: java.lang.ClassCastException: cscie160.project.AccountImpl_St
b cannot be cast to cscie160.project.AccountImpl
Failed as expected: java.lang.ClassCastException: cscie160.project.AccountImpl_
tub cannot be cast to cscie160.project.AccountImpl
Unexpected error: java.lang.ClassCastException: cscie160.project.AccountImpl_St
b cannot be cast to cscie160.project.AccountImpl
java.lang.ClassCastException: cscie160.project.AccountImpl_Stub cannot be cast
o cscie160.project.AccountImpl
at cscie160.project.ATMImpl.getBalance(ATMImpl.java:134)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown So
rce)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Sou
ce)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Sourc
)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unkno
n Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at cscie160.project.ATMImpl_Stub.getBalance(Unknown Source)
at cscie160.project.Client.printBalances(Client.java:68)
at cscie160.project.Client.testATM(Client.java:63)
at cscie160.project.Client.main(Client.java:35)

Can anybody please explain what is the cause of this error??? The code is too big, so i can post the portion of the relevant code if you want.But right now i am clueless what the problem is?

Thanks.
 
Georg Brunmayr
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i've the same problem... how did you solved it??
 
Suhas Bilaye
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please check this thread
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic