Re: Problem with RMI Creating an extra port

Greg Luck <[email protected]> Mon, 29 Sep 2008 07:41:23 +1000
Newsgroups gmane.comp.java.sun.rmi
Message-ID <[email protected]>
Hi

Mac OS X


Regards

Greg Luck

web: http://gregluck.com
skype: gregrluck
yahoo: gregrluck
mobile: +61 408 061 622


It is possible it is a client connection. The "  //Sep 26 21:30:36  
Greg-Lucks-Laptop Firewall[57]: java is listening from ::ffff: 
127.0.0.1:57915 uid = 501 proto=6"
talked about it listening, which made me think it was a server  
connection.

The user has now reported that opening up both the RMI Registry port  
and the Remote Object Port in in ehcache RMI replication did the trick.

Can you tell me a netstat command that will clearly show that the  
extra port is a client connection? That will fully resolve this for me.

"I think one is the rmi registry port and the other one is the remote  
object port.  The replication working just fine by using the ports  
40001 and 50001 in both servers and opening these ports for in/out  
traffic in the firewall.

<cacheManagerPeerListenerFactory
class="net.sf.ehcache.distribution.RMICacheManagerPeerListenerFactory"
properties 
= 
"hostName 
= 
machine_a 
.test 
.com,port=40001,remoteObjectPort=50001,socketTimeoutMillis=120000"/>

Thank you for looking into it."


On 27/09/2008, at 1:46 AM, Peter Jones wrote:

> On Fri, Sep 26, 2008 at 05:46:31AM -0600, Greg Luck wrote:
>> Following is a simple example that sets a port for
>> UnicastRemoteObject and for the RMI Registry.
>>
>> I am having this problem with ehcache RMI replication (which I
>> maintain) as reported my a user trying to get it to work through a
>> firewall.
>>
>> The problem is that when Naming.rebind() is called, a new random
>> port gets listened on.
>>
>> I do not understand why this is happening or how I can stop it from
>> happening. This example follows the ways of controlling port usage
>> as described in this list, from what I have read.
>>
>> package net.sf.ehcache.distribution;
>>
>> import java.rmi.registry.LocateRegistry;
>> import java.rmi.server.*;
>> import java.rmi.*;
>>
>> public class RMIPortUsage extends UnicastRemoteObject {
>>
>>    private static RMIPortUsage rmi;
>>
>>    protected RMIPortUsage(int port) throws RemoteException {
>>        super(port);
>>    }
>>
>>    public static void main(String[] args) throws Exception {
>>        int port = 10001;
>>        String service = "rmi://127.0.0.1" + ':' + port + '/' +
>>                "Pips";
>>        rmi = new RMIPortUsage(port);
>>        LocateRegistry.createRegistry(port);
>>
>>        //Ports being listend to:
>>        //Sep 26 21:29:52 Greg-Lucks-Laptop Firewall[57]: java is  
>> listening from ::ffff:0.0.0.0:10001 uid = 501 proto=6
>>        Naming.rebind(service, rmi);
>>
>>
>>        //Ports being listened to:
>>        //Sep 26 21:29:52 Greg-Lucks-Laptop Firewall[57]: java is  
>> listening from ::ffff:0.0.0.0:10001 uid = 501 proto=6
>>        //Sep 26 21:30:36 Greg-Lucks-Laptop Firewall[57]: java is  
>> listening from ::ffff:127.0.0.1:57915 uid = 501 proto=6
>
> This code indeed should only cause RMI to listen on one port (10001),
> and that is in fact the case when I run it, with various JDK versions
> on Solaris 10-- what JDK version and OS are you using?
>
> The Naming.rebind invocation should not cause RMI to create any new
> passive/listening sockets--- it would, however, cause the first
> active/connecting socket to be created, to port 10001, for the RMI
> call to the registry.  Are you certain that the port 57915 (in the
> above-described case) was not just the peer port on the client side of
> that connection?
>
> -- Peter
>
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> To unsubscribe, send email to [email protected] and include in  
> the body
> of the message "signoff RMI-USERS".  For general help, send email to
> [email protected] and include in the body of the message "help".
>
> For a list of frequently asked RMI questions please refer to:
> http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html
>
> To view past RMI-USERS postings, please see:
> http://archives.java.sun.com/archives/rmi-users.html
>
>


===========================================================================
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff RMI-USERS".  For general help, send email to
[email protected] and include in the body of the message "help".

For a list of frequently asked RMI questions please refer to:
http://java.sun.com/j2se/1.3/docs/guide/rmi/faq.html

To view past RMI-USERS postings, please see:
http://archives.java.sun.com/archives/rmi-users.html