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

The same problem on Connection

 
Ying Ren
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic