Tomcat Cannot assign requested address: JVM_Bind [How to Solve]

When you started Tomcat 7.0 or Tomcat 8.0 yesterday, you can’t start it correctly. Whether you call batch script through the command line or start it after integration in eclipse, you will be prompted with the following exception stack information:

Warning: 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(

Since both Tomcat 7.0 and Tomcat 8.0 on my machine worked normally before that, we can confirm that there was no problem with the installation package

However, according to the abnormal information, it can be inferred that the port or some resources that Tomcat needs to bind are occupied by other applications. After searching on the Internet, try DOS command netstat - an to check the occupied port, no program is found to occupy the relevant port used by Tomcat (such as 8080), and change the port in conf/server. XML file in Tomcat installation directory to another port, and it can’t start normally after running again

Through a variety of tests, it can be preliminarily judged that the problem should not be caused by port occupation. If it is not the problem of port occupation, then it is necessary to consider whether it is the problem of IP binding

After checking, the following contents are found in the file C:: :       localhost    localhost is a nonexistent local IP address. After removing the second line of the hosts file, localhost , start Tomcat again and find that it is running normally

In the field of server, it is common for a computer to configure multiple IP addresses. When Tomcat starts, it will obtain all IP addresses according to the configuration and bind them one by one. When it is found that the IP address to be bound does not exist, the above exception will be triggered, resulting in the failure to start normally

If you want to know which IP addresses are bound to the localhost on a machine, you can use the following java code to simply output the results

//Output all IP addresses mapped by localhost 
InetAddress[] ips = InetAddress.getAllByName("localhost"); 
if (ips != null) {     
	for (InetAddress ip : ips) {         

After deleting other mappings except localhost, restart tomcat, and the problem is solved

Similar Posts: