Limiting RMI to localhost

E

EJP

In the sample I implemented server socket factory so I'll be able to
bind it to the localhost and a client factory because it didn't work
without it.

It should work perfectly without a CSF. What problem did you get? Remove
it, specify null, and restore your RMIServerSocketFactory.equals()
method to what you had before. And tell us the problem.
The problem is still that it seems that the client is trying to bind
to the DNS address instead of the loopback interface and provides the
following exception:

No, the client isn't trying to 'bind' to anything. It's trying to
*connect* to the DNS address. You now need to set
-Djava.rmi.server.hostname=127.0.0.1 in the server JVM, either via this
command line or via System.setProperty.
 
H

haimcn

That is *unnecessary* engineering. I already told the OP he didn't need
a client socket factory. The one he wrote is practically identical to
the default.


belong to the same class?  That doesn't make sense. I don't see any
reason to override equals() whatsoever.

Then you need to learn more about the semantics of RMI socket factories.
This is the standard form for RMIClientSocketFactory.equals(). But the
OP doesn't need the class at all.


You're right but for the wrong reasons. RMIServerSocketFactories
shouldn't be compared on a class basis, only client socket factories.
Server socket factories should be compared on a protocol basis. If they
don't superimpose a protocol over TCP, or the protocols are equal, they
are equal.

Well... I admit that I'm guilty in all...
I just copied the sample from the RMI documentation, cleaned the
unrelated things and did it fast and dirty.
For my needs I guess the class basis comparison is correct...
 
H

haimcn

It should work perfectly without a CSF. What problem did you get? Remove
it, specify null, and restore your RMIServerSocketFactory.equals()
method to what you had before. And tell us the problem.


No, the client isn't trying to 'bind' to anything. It's trying to
*connect* to the DNS address. You now need to set
-Djava.rmi.server.hostname=127.0.0.1 in the server JVM, either via this
command line or via System.setProperty.

Thanks!!!
That what I needed!!

So I really don't need to implement any socket factory and the problem
solved :)

Thanks!
Haim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,775
Messages
2,569,601
Members
45,182
Latest member
alexanderrm

Latest Threads

Top