aspose file tools*
The moose likes Distributed Java and the fly likes distributed banking code , getting error : _stub class cannot be casted!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "distributed banking code , getting error : _stub class cannot be casted!!!" Watch "distributed banking code , getting error : _stub class cannot be casted!!!" New topic
Author

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

Smriti Awasthi
Greenhorn

Joined: Dec 03, 2009
Posts: 4
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

Joined: Feb 19, 2010
Posts: 7
i've the same problem... how did you solved it??
Suhas Bilaye
Ranch Hand

Joined: Sep 10, 2009
Posts: 80
Please check this thread


Thanks and Regards,
Suhas
http://www.xplore-java.blogspot.com/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: distributed banking code , getting error : _stub class cannot be casted!!!