db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristian Waagan <Kristian.Waa...@Sun.COM>
Subject Re: BindException with NetWork server
Date Thu, 13 Nov 2008 14:18:49 GMT

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
System.out.println("end instantiate");

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 Waagan wrote:
> Michael Bell wrote:
>> Derby 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 -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.

View raw message