From owner-freebsd-java@FreeBSD.ORG Fri Nov 21 03:23:48 2003 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5EFD716A4CE for ; Fri, 21 Nov 2003 03:23:48 -0800 (PST) Received: from hannibal.gnapp.org (c-8c8772d5.05-19-73746f42.cust.bredbandsbolaget.se [213.114.135.140]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0BD7E43FE1 for ; Fri, 21 Nov 2003 03:23:44 -0800 (PST) (envelope-from david@israelsson.org) Received: from hannibal.gnapp.org (localhost [127.0.0.1]) by hannibal.gnapp.org (8.12.9/8.12.9) with ESMTP id hALBNhbw096706 for ; Fri, 21 Nov 2003 12:23:43 +0100 (CET) (envelope-from david@israelsson.org) Received: (from david@localhost) by hannibal.gnapp.org (8.12.9/8.12.9/Submit) id hALBNdju096680; Fri, 21 Nov 2003 12:23:39 +0100 (CET) X-Authentication-Warning: hannibal.gnapp.org: david set sender to david@israelsson.org using -f To: freebsd-java@freebsd.org References: <87fzgjbdnq.fsf@poh.gnapp.org> <20031120095224.GR11487@starjuice.net> <877k1vb7tt.fsf@poh.gnapp.org> <20031120121152.GT11487@starjuice.net> From: David Israelsson Date: Fri, 21 Nov 2003 12:23:38 +0100 Message-ID: <87n0aq6k3p.fsf@poh.gnapp.org> User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: RMI on FreeBSD X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Nov 2003 11:23:48 -0000 Sheldon Hearn writes: > What do you expect to happen trying to connect to the local host before > a listening service has bound to the appropriate port? I'd expect > "Connection refused". > Of course, that was only to make sure that it connects to the right service. No rmiregistry running -> connection refused, rmiregistry running -> no exception thrown. Hence, the rmi server successfully connects to the rmiregistry. > My original reply simply answered the question "is RMI broken on > FreeBSD", for which the answer is probably "no". I'm now guessing. :-) > Well, there's _something_ with FreeBSD that makes my RMI test case not working. Here's a test program that demonstrates the problem: import java.rmi.*; import java.rmi.server.UnicastRemoteObject; public class RMITest extends UnicastRemoteObject implements Remote { public RMITest() throws RemoteException { super(); } public static void main(String[] args) throws Exception { long millis = System.currentTimeMillis(); Naming.rebind("//localhost:2001/Test", new RMITest()); System.out.println("Got here after " + ((System.currentTimeMillis() - millis) / 1000) + " seconds."); } } And here's what I do with it: poh:~/rmitest> javac RMITest.java poh:~/rmitest> rmic RMITest poh:~/rmitest> rmiregistry 2001& [1] 42631 poh:~/rmitest> java RMITest Got here after 76 seconds. poh:~/rmitest> It should take one or two, possibly three seconds, not 76. And the program shouldn't exit afterwards. The same program works exactly like it's supposed to when I boot Linux on the same computer. Yes, it seems like a network problem. What happens in the Naming.rebind() method is that the rmi server reports its ip number and the port it has allocated, then the rmiregistry tries to contact the rmi server on that ip number and port. This is where it fails. It works if I first turn off the external interface. In both cases (FreeBSD and Linux) I get the same network settings from my isp's dhcp server, and a traceroute to the remote ip number from my computer indicates that the traffic does not go through any gateways. Is my system broken? If so, how could I fix it? Can anybody get that tiny little test program working? /David