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.


--
Kristian

Cause:

Good question. My code is merely

            NetworkServerControl nc = new NetworkServerControl();
            nc.start(new PrintWriter(System.out));

Comments:

This has been a repeated issue. We USUALLY get around it by retrying 
connections for 30 seconds, but not always

eg the next few lines are

          Class.forName(DERBY_NETWORK_CLIENT_DRIVER);
              } catch (Exception varException)
        {
            log.info(MSG_INIT_FAILURE);
            ErrorHandle.reportError("DerbyStartup", varException);
            throw new IllegalStateException("Cannot proceed without Derby!");
        }
        Connection con=null;
                try {
                        con = 
DerbyInitializerServlet.getConnectionWithRetry(ascfg); // retry every 500ms for 
30 seconds before giving up
                } catch (SQLException e1) {
                        log.error("Couldn't get Conn with Retry");
                } finally {
                        Parm.close(con);
                
Derby.log:

Apache Derby Network Server - 10.4.2.0 - (689064) started and ready to accept connections on port 1527 at 2008-11-12 22:46:13.328 GMT Could not listen on port 1527 on host localhost:
 java.net.BindException: Address already in use: JVM_Bind
An exception was thrown during network server startup. DRDA_ListenPort.S:Could 
not listen on port 1527 on host localhost:
 java.net.BindException: Address already in use: JVM_Bind
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.derby.iapi.jdbc.DRDAServerStarter.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.Exception: DRDA_ListenPort.S:Could not listen on port 1527 
on host localhost:
 java.net.BindException: Address already in use: JVM_Bind
        at 
org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessageWork(Unknown
 Source)
        at 
org.apache.derby.impl.drda.NetworkServerControlImpl.consolePropertyMessage(Unknown
 Source)
        at 
org.apache.derby.impl.drda.NetworkServerControlImpl.blockingStart(Unknown 
Source)
        ... 6 more


What it's not

- not a firewall issue. Firewall is off
- Not true that derby is running, and netstat -a confirms this.




Reply via email to