File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes The same problem on Connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "The same problem on Connection" Watch "The same problem on Connection" New topic
Author

The same problem on Connection

Ying Ren
Ranch Hand

Joined: May 24, 2002
Posts: 35
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"

How to solve it?
YING REN
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

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
Ying Ren
Ranch Hand

Joined: May 24, 2002
Posts: 35
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
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Yes your ServerGUI is the same as my ConnectionFactoryEngine class
Another thing, I put my register and rebind into my newActionListener, does it matter?

I am confused here. The only thing you should bind is your ServerGUI. what is my register and rebind into my newActionListener mean?
Mark
 
Don't get me started about those stupid light bulbs.
 
subject: The same problem on Connection