Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 94588 invoked from network); 13 Nov 2008 14:19:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Nov 2008 14:19:25 -0000 Received: (qmail 9759 invoked by uid 500); 13 Nov 2008 14:19:31 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 9739 invoked by uid 500); 13 Nov 2008 14:19:31 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 9728 invoked by uid 99); 13 Nov 2008 14:19:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Nov 2008 06:19:30 -0800 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [192.18.6.24] (HELO gmp-eb-inf-2.sun.com) (192.18.6.24) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Nov 2008 14:18:09 +0000 Received: from fe-emea-09.sun.com (gmp-eb-lb-2-fe2.eu.sun.com [192.18.6.11]) by gmp-eb-inf-2.sun.com (8.13.7+Sun/8.12.9) with ESMTP id mADEIq0i004235 for ; Thu, 13 Nov 2008 14:18:52 GMT Received: from conversion-daemon.fe-emea-09.sun.com by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) id <0KA900G01YSI3500@fe-emea-09.sun.com> (original mail from Kristian.Waagan@Sun.COM) for derby-user@db.apache.org; Thu, 13 Nov 2008 14:18:52 +0000 (GMT) Received: from [129.159.139.71] by fe-emea-09.sun.com (Sun Java System Messaging Server 6.2-8.04 (built Feb 28 2007)) with ESMTPSA id <0KA900COXZRFPWD0@fe-emea-09.sun.com> for derby-user@db.apache.org; Thu, 13 Nov 2008 14:18:51 +0000 (GMT) Date: Thu, 13 Nov 2008 15:18:49 +0100 From: Kristian Waagan Subject: Re: BindException with NetWork server In-reply-to: <491B68E2.9040502@Sun.COM> Sender: Kristian.Waagan@Sun.COM To: Derby Discussion Message-id: <491C3749.6060009@Sun.COM> Organization: Sun Microsystems MIME-version: 1.0 Content-type: text/plain; format=flowed; charset=ISO-8859-1 Content-transfer-encoding: 7BIT References: <491AEDAA.ECB9.0090.0@gwava.com> <491B68E2.9040502@Sun.COM> User-Agent: Thunderbird 2.0.0.6 (X11/20071119) X-Virus-Checked: Checked by ClamAV on apache.org Hello, I was asked offline by Michael to post the message below for him. ----- Michael I figured it out. System.setProperty("derby.system.home", ascfg.getEBDBPath() ); System.setProperty(START_NETWORK_SERVER, "true"); System.out.println("start me"); NetworkServerControl nc = new NetworkServerControl(); // change to nc.start(new PrintWriter(System.out)) to see // error messages from server nc.start(new PrintWriter(System.out)); System.out.println("end start"); if( !ascfg.isInitDone()) Thread.sleep(ARBITRARY_DELAY); // and the Client driver for actual access (certainly the connection pool uses this) Class.forName(DERBY_NETWORK_CLIENT_DRIVER); System.out.println("end instantiate"); log.info(MSG_INIT_SUCCESS); This showed the error didn't occur till after this code - until the client driver was instantiated! The system.setproperty for start_network_server has to be left out, or else the client driver (not the embedded one, or I might have guessed this!) tries to start a second derby. The system.setproperty was a left over legacy, since the previous program had used that plus the embedded driver to start up Derby. When I refactored to use the "more elegant" NetWorkServerControl, I left the setproperty in, figuring it was harmless. and I figured the client didn't have the same logic as the embedded. Sigh. Live and learn! Lord know what it is about posting a message about something one has been thinking about for a couple of months that clarifies one's thinking! ----- -- Kristian Kristian Waagan wrote: > Michael Bell wrote: >> Derby 10.4.2.0. Also experienced with earlier. >> Java 1.42_16/1.5_16 >> Windows XP, 2000, 2003. Might also be case on Linux >> Tomcat 4.1, 5.5 >> >> Situation: >> >> from the System.out (see below) >> >> Could not listen on port 1527 on host localhost: >> java.net.BindException: Address already in use: JVM_Bind >> > > Hello Michael, > > Just a few initial questions: > a) Has Derby been started/restarted earlier when this happens, or does > it happen on the first startup attempt? > b) Have you confirmed that you have nothing else running on port 1527? > c) From where are you starting the Derby network server? > (i.e. standalone app, appserver, embedded in another app) > d) Does the same thing happen if you start the server with "java -jar > derbyrun.jar server start -h 0.0.0.0 -p 1527" (or omit -h if you want > to use localhost only)? > e) Are you using IPv6? > > What you describe sure sounds as issues in the socket handling of the > OS (or possibly Java) or that something else is using the port, but if > it happens the first time you start Derby it might be a bug in Derby > itself. > If you can easily reproduce this, it would be nice if you could run > with the debug version. > >