I'm using JBoss 3.2.3 in the configuration that's bundled with ITracker 2.4.0. (http://www.cowsultants.com). It works fine on a Windows machine, but on Solaris it gets a "Connection refused" exception when it tries to connect to HSQLDB.
I'm using Oracle as the backend DB, so the instance of HSQLDB that is not connecting properly is the one that JBoss uses to store configuration information. The logs indicate that HSQLDB is started properly, "HSQLDB server 1.7.1 is running" I put debugging code in HSQLDB to verify that it's listening on port 1701, and netstat -an also says it's listening on 1701. I put debugging code in org.hsqldb.jdbcConnection.reconnectHSQL() to verify that it's trying to connect to localhost:1701, but the line:
sSocket = new Socket(host, port);
throws the Connection refused exception, as if there were no processes listening on 1701.
I was able to work around this by putting a retry loop into the HSQLDB code. When the "Connection refused" occurs, it will sleep for three seconds and try again, up to five attempts. I also changed the connection code to include a timeout:
sSocket = new Socket();
sSocket.connect(new java.net.InetSocketAddress(host, port), 3000);
Now everything seems to work, but the connection doesn't ususally succeed on the first or second attempt.
I am totally baffled by this. Has anyone else encountered this, or does anyone have any clues as to why it's occuring? I hate to apply a solution to a problem when I don't understand why it occurred in the first place.