Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

classCastException

 
no more user
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i have my server structured like this:
- suncertify.server
ServerFrame
DataConnection ext unicast impl DataInterface
ConnectionFactory ext unicast impl FactInterface
The stubs..
LockManager
- suncertify.server.database
Data
DataInterface implements Remote
FactoryInterface implements Remote
i run the server ok but when i lookup in client i get..

this happen only when is arrange in packages
please, if anyonee can help me
tanks in advance
 
Leonardo Penha
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the reference to the remote object in the client
should be of DataInterface type.
 
no more user
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi leonardo,
yes, the reference is of DataInterface type, the client dont know the implementation object..
look

package suncertify.server;
public final class ConnectionFactory_Stub
extends java.rmi.server.RemoteStub
implements suncertify.server.database.FactoryInterface, java.rmi.Remote
{

why my stub implements Remote two times !?
i have to take the remote interface and implementation in the same package ?!
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alex,
The reference for your ConnectionFactory should be a FactInterface.
Hope this helps,
Michael Morris
 
no more user
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Michael,
thanks again for you response,
the problem is that my DataInterface and FactoryInterface stay on client and server..
in client its is suncertify.client.DataInterface and in the server suncertify.server.DataInterface, because this the classCastException.
i solve this problem moving up my remote interfaces (inclusive the datainfo, fieldinfo e dbexception) to package suncertify, these are classes used for both, client and server..
its is correct?!
sorry for doubts of inexperience..
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi alex,
Do you have a good reason for not leaving them in suncertify.db. I agree with putting them together and so long as you feel you have a legitimate reason for moving them up a level, I suppose it would be OK. I'm not so sure that the FactInterface should be in the same package as the the db classes though. It seems to me that it should logically be in the suncertify.server package. Since only you know your full design, only you can decide on what class goes in what package.
Hope this helps,
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic