The same problem on Connection

Ying Ren

Ranch Hand

Posts: 35

posted 14 years ago

Mark, I have checked your last year post, I have the same problem: "Now please don't tell me I am wrong in doing this, but I removed the RMISecurityManager from the Server. So now it works, but I have designed a test client, and when I do a Naming.lookup(url); and try to compile the test class, it is asking me to cast the lookup to a ConnectionFactory_Stub, and not a ConnectionFactory. Mark"

First, I did not have an RMISecurityManager on the server at all myself, so nothing wrong there, and you can even remove it from the client, if you wish. What happens if you cast it to a ConnectionFactory? Mark

Wait a second, I have no such thing as a stub for my ConnectionFactory. Are you putting this object in the RMI Registry? It is only to be a remote object, that implements remote, not one that goes into the registry. The registry is for your ConnectionFactoryEngine. The client will lookup and get this object, then it will call the getConnection method of it and return an instance of ConnectionFactory. This is especially in regards to your other question about two objects implementing Remote. That is fine, you just have one object that will extend UnicastRemoteObject Mark

Mark, Thank you for your reply. I think your connectionEngine should be the same as my ServerGUI which will have main method. If so, my ServerGUI should extend unicast...and implement the remote, so that it can be rebound. If not, what the connectionEngine for? Please help me out. Thanks. Another thing, I put my register and rebind into my newActionListener, does it matter? Ying REN