From owner-freebsd-java@FreeBSD.ORG Fri Nov 21 03:38:34 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 293A816A4CE for ; Fri, 21 Nov 2003 03:38:34 -0800 (PST) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.FreeBSD.org (Postfix) with SMTP id AA99943F75 for ; Fri, 21 Nov 2003 03:38:32 -0800 (PST) (envelope-from andreas.kohn@gmx.net) Received: (qmail 17898 invoked by uid 65534); 21 Nov 2003 11:38:31 -0000 Received: from unknown (HELO mobile.ankon.homeip.net) (139.30.33.179) by mail.gmx.net (mp010) with SMTP; 21 Nov 2003 12:38:31 +0100 X-Authenticated: #2431876 Date: Fri, 21 Nov 2003 12:38:31 +0100 From: Andreas Kohn To: David Israelsson Message-Id: <20031121123831.16dc7c27.andreas.kohn@gmx.net> In-Reply-To: <87n0aq6k3p.fsf@poh.gnapp.org> References: <87fzgjbdnq.fsf@poh.gnapp.org> <20031120095224.GR11487@starjuice.net> <877k1vb7tt.fsf@poh.gnapp.org> <20031120121152.GT11487@starjuice.net> <87n0aq6k3p.fsf@poh.gnapp.org> Organization: X-Mailer: Sylpheed version 0.9.5-gtk2-20030906 (GTK+ 2.2.4; i386-portbld-freebsd5.1) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit cc: freebsd-java@freebsd.org 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:38:34 -0000 On Fri, 21 Nov 2003 12:23:38 +0100 David Israelsson wrote: > 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? Hi, I tried it using jdk 1.4.2p5 on FreeBSD 5.1-CURRENT (Nov 17). Works flawlessly: [mobile] ~/projects/java>javac RMITest.java [mobile] ~/projects/java>/usr/local/java/bin/rmic RMITest [mobile] ~/projects/java>java RMITest Got here after 0 seconds. -- Andreas Kohn