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
基础教程推荐
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
