Tomcat startup gave the notorious
java.net.BindException: Cannot assign requested address. This usually means that another process is listening on the same port on this machine. I started with ps -ef grep java to make sure that no other tomcat process was running on the machine. Nothing.I suspected that maybe some other web server was holding the port, but
netstat -an showed that nothing binds this address. Moreover, telnet localhost 80 showed that no one is listening.Looking at the server.xml I found out that the connector was binding to the hostname "demoserver" on port 80.
<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
address="demoserver" port="80"
minProcessors="5" maxProcessors="75"
enableLookups="true" redirectPort="8443"
acceptCount="100" debug="0" connectionTimeout="20000"
useURIValidationHack="false" disableUploadTimeout="true" />
trying to
ping demoserver gave me errors, but nslookup demoserver gave me the right ip address.After a few minutes I noticed that some clown added demoserver to
/etc/hosts with the wrong ip address. Fixing /etc/hosts to have the right ip address for demoserver made tomcat work smooth and nice.