From owner-freebsd-java@FreeBSD.ORG Sat Nov 12 00:34:15 2005 Return-Path: X-Original-To: freebsd-java@freebsd.org 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 D85EF16A41F; Sat, 12 Nov 2005 00:34:15 +0000 (GMT) (envelope-from rschi@rsmba.biz) Received: from admin.cablespeed.com (admin.cablespeed.com [216.15.205.79]) by mx1.FreeBSD.org (Postfix) with ESMTP id 77EDF43D45; Sat, 12 Nov 2005 00:34:15 +0000 (GMT) (envelope-from rschi@rsmba.biz) Received: from [66.235.9.146] (account schilling@cablespeed.com HELO [192.168.2.2]) by admin.cablespeed.com (CommuniGate Pro SMTP 4.2.10) with ESMTP id 60853807; Fri, 11 Nov 2005 18:34:14 -0600 Message-ID: <43753947.3040108@rsmba.biz> Date: Fri, 11 Nov 2005 16:37:27 -0800 From: Richard Schilling Organization: Richard Schilling, MBA User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.5) Gecko/20050318 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-java@freebsd.org, freebsd-amd64@freebsd.org Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: Subject: BindAddress exception error (was BindAddress error with jdk1.5 and Tomcat and Resin) X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Nov 2005 00:34:16 -0000 I'm narrowing down a problem with BindAddress on jdk1.5, FreeBSD RELENG_6 . uname -a output: FreeBSD newbox.cognitiongroup.biz 6.0-STABLE FreeBSD 6.0-STABLE #3: Fri Nov 4 23:36:56 PST 2005 rschilling@cognitiongroup.biz:/usr/obj/usr/src/sys/PRODUCTION amd64 Here's the error: $ java TestServer localhost 8080 Host Address=localhost Port =8080 Exception in thread "main" java.net.BindException: Can't assign requested address at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359) at java.net.ServerSocket.bind(ServerSocket.java:319) at java.net.ServerSocket.bind(ServerSocket.java:277) at TestServer.main(TestServer.java:15) $ Check out http;//bugs.sun.com/bugdatabase/view_bug.do?bug_id=6206527 I'm able to reproduce the error with the following code, with IPv6 enabled and with IPv6 disabled... import java.net.*; public class TestServer { public static void main (String[] args) throws Exception { if (args.length != 2) { System.out.println("Usage: java TestServer "); System.exit(1); } System.out.println("Host Address="+args[0]); System.out.println("Port ="+args[1]); ServerSocket ss = new ServerSocket(); ss.bind(new InetSocketAddress(InetAddress.getByName(args[0]), Integer.parseInt(args[1]))); System.out.println("ServerSocket Bound"); ss.accept(); } }