java.net.BindException: Address already in use: JVM_Bind(java.net.BindException:地址已在使用中:JVM_Bind)
问题描述
我的服务器中有 2 个 tomcat 正在运行
I have 2 tomcats running in my server
一个是tomcat 7,一个是tomcat 8,第一个的配置文件server.xml是:
one Tomcat 7 and the other is tomcat 8, the configuration file server.xml for the first is:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
...
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
在第二个tomcat中有:
In the second tomcat have:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
...
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
但是当我运行第一个 tomcat 时,控制台说
but when I run the first tomcat the console say
java.net.BindException: Address already in use: JVM_Bind
at java.net.DualStackPlainSocketImpl.bind0(Native Method)
at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at org.apache.catalina.core.StandardServer.await(StandardServer.java:420)
at org.apache.catalina.startup.Catalina.await(Catalina.java:713)
at org.apache.catalina.startup.Catalina.start(Catalina.java:659)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
但第二次运行良好,我使用命令 netstate -tnao 并验证端口是免费的
but the second run good, i using the command netstate -tnao and i verified that the ports are free
推荐答案
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
8080 是服务器将运行的端口号.只有一个服务器(您将首先启动)将运行.其他的会抛出 Jvm Bind Exception.
8080 is the port number on which server will run. Only one server (which you will start first) would run. Other one will throw Jvm Bind Exception.
所以,更改端口号,使它们是唯一的.
So, change the port number so that they are unique.
你运行第一台服务器然后使用 netstat
命令查看正在使用的端口.
One you run first server then use netstat
command to see the ports which are in use.
这篇关于java.net.BindException:地址已在使用中:JVM_Bind的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:java.net.BindException:地址已在使用中:JVM_Bind


- 如何使用WebFilter实现授权头检查 2022-01-01
- Eclipse 插件更新错误日志在哪里? 2022-01-01
- value & 是什么意思?0xff 在 Java 中做什么? 2022-01-01
- Jersey REST 客户端:发布多部分数据 2022-01-01
- C++ 和 Java 进程之间的共享内存 2022-01-01
- Safepoint+stats 日志,输出 JDK12 中没有 vmop 操作 2022-01-01
- 从 finally 块返回时 Java 的奇怪行为 2022-01-01
- Spring Boot连接到使用仲裁器运行的MongoDB副本集 2022-01-01
- 将log4j 1.2配置转换为log4j 2配置 2022-01-01
- Java包名称中单词分隔符的约定是什么? 2022-01-01