Tomcat Cannot assign requested address: JVM_Bind non port occupation conflict

  • 2020-05-30 20:16:44
  • OfStack


Recently, when installing and starting Tomcat 6.0, my friend found that 1 could not start correctly. The main exception stack information is as follows:

 serious : StandardServer.await: create[8005]: Cannot assign requested address: JVM_Bind
 at Method)
 at org.apache.catalina.core.StandardServer.await(
 at org.apache.catalina.startup.Catalina.await(
 at org.apache.catalina.startup.Catalina.start(
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(
 at java.lang.reflect.Method.invoke(
 at org.apache.catalina.startup.Bootstrap.start(
 at org.apache.catalina.startup.Bootstrap.main(

Friends' Tomcat 6.0 is the official install-free version and has just been downloaded, so it should not be a problem of missing files.

Based on the exception information, it could be that the port or some resource that Tomcat needs to bind to is occupied by another application.

Use the DOS command netstat-an to view the occupied port. No program has been found to be using the port used by Tomcat (for example, 8080). Change the port in the conf/ server.xml file in the Tomcat installation directory to another port.

Through a variety of tests, it can be preliminarily determined that the problem should not be caused by port occupation. If it's not port occupancy, consider whether it's an IP binding.

After checking, the following contents were found in the C:\Windows\System32\drivers\etc\hosts file on the friend's server computer:    localhost  localhost is a local IP address that does not exist. After removing the content of the second line localhost in the hosts file, start Tomcat again.

In the server world, it is common for one computer to have multiple IP addresses. When Tomcat is started, it will get all the IP addresses according to the configuration and bind them one by one. When it is found that the IP addresses that need to be bound do not exist, the above exception will be triggered, resulting in the failure to start normally.

// The output localhost All of the mapped IP address 
InetAddress[] ips = InetAddress.getAllByName("localhost");
if (ips != null) {
  for (InetAddress ip : ips) {
/*  Modify the above hosts Before the file, output: 
*  After modifying the file, output 

Thank you for reading, I hope to help you, thank you for your support of this site!

Related articles: