Hi all, this is my first post... and my voucher is expiring in 2 mths
Just a finding I'd like to share about RMI and the local/remote interfaces problem.
I was thinking of a way where I could write a single local impl, and my remote impl would basically call the local impl to perform all the tasks (code reuse basically).
Based on the follow snippets:
When I run my server and client, I will always get an exception that says "$Proxy0 cannot be cast to xxx.Service".
After some trial and error, I made the following changes
Everything else works fine... and when I call getStatus() I will get "from xx.ServiceRemoteImpl" which is exactly what I want
My question is, why wouldn't my first approach work? Since ServiceRemoteImpl implements Remote and extends ServiceImpl (which implements Service) and therefore should be just what I need. Any RMI gurus out there that can provide a good answer?
As far as I'm concerned, the 2nd approach doesn't seems to break any SUN's rules and I'd prob use it for my assignment... however, it's all about learning and I'd like to find out what went wrong!
Thanks for viewing...