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]: java.net.BindException: Cannot assign requested address: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
at java.net.ServerSocket.bind(ServerSocket.java:319)
at java.net.ServerSocket.(ServerSocket.java:185)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:406)
at org.apache.catalina.startup.Catalina.await(Catalina.java:676)
at org.apache.catalina.startup.Catalina.start(Catalina.java:628)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
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:: :
127.0.0.1 localhost 169.196.254.14 localhost
169.196.254.14 is a nonexistent local IP address. After removing the second line of the hosts file, 169.196.254.14 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) {
System.out.println(ip.getHostAddress());
}
}
After deleting other mappings except 127.0.0.1 localhost, restart tomcat, and the problem is solved
Similar Posts:
- Tomcat Command Error: Catalina.stop: connect reused solution
- [Solved] Error configuring application listener of class [org.springframework.web.util.Log4jConfigListener]
- [Solved] Caused by: org.apache.catalina.LifecycleException: A child container failed during start
- [Solved] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive
- [Solved] org.apache.catalina.LifecycleException: Failed to start component
- [Solved] linux Error: springboot org.springframework.context.ApplicationContextException: Failed to start bean ‘webServerStartStop’
- [Solved] Idea service startup error: no buffer space available (maximum connections reached): the solution of connect.
- Sudo starts Tomcat and reports an error. There is no Java environment
- Error starting Tomcat invalid LOC header [How to Solve]
- java.lang.UnsupportedClassVersionError:Unsupported major.minor version 52.0