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

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