Thursday, April 02, 2009

java.net.BindException: Address already in use: JVM_Bind

After setting up SSL on a web server not running on a standard port I had to remind myself what was going on when I got this error:

java.net.BindException: Address already in use: JVM_Bind

Obviously two things were running on the same port. What I forgot was the default port was set to run on the same port I had set up SSL to run on. I commented out the default port in the configuration and now the web server only accepts SSL connections. (Which is what I wanted - I could have also set it up to accept http requests on one port and https requests on a different port).

This same error also happens when you have two applications configured to listen on the same port. For instance when running Tomcat, Apache and/or IIS on the same machine. They are HTTP web severs so typically all run on port 80 so have to configure them to run on different ports.