Java 在tomcat启动时通常只允许每个套接字地址(协议/网络地址/端口)使用一次?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21299942/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Only one usage of each socket address (protocol/network address/port) is normally permitted while tomcat start?
提问by user3198603
Here is my connector element in server.xml. I also tried using 8443 instead of 8484 but same error.
这是我在 server.xml 中的连接器元素。我也尝试使用 8443 而不是 8484 但同样的错误。
<Connector
SSLEnabled="true"
acceptCount="100"
connectionTimeout="20000"
executor="tomcatThreadPool"
keystoreFile="D:/.keystore"
keystorePass="changeit"
maxKeepAliveRequests="15"
port="8484"
protocol="HTTP/1.1"
redirectPort="8484"
scheme="https"
secure="true"
allowUnsafeLegacyRenegotiation="true"/>
SEVERE: Error starting endpoint
java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.
at org.apache.tomcat.util.net.AprEndpoint.init(AprEndpoint.java:649)
at org.apache.tomcat.util.net.AprEndpoint.start(AprEndpoint.java:766)
at org.apache.coyote.http11.Http11AprProtocol.start(Http11AprProtocol.java:137)
at org.apache.catalina.connector.Connector.start(Connector.java:1122)
at org.apache.catalina.core.StandardService.start(StandardService.java:540)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Jan 23, 2014 10:05:26 AM org.apache.catalina.core.StandardService start
SEVERE: Failed to start connector [Connector[HTTP/1.1-8484]]
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.
at org.apache.catalina.connector.Connector.start(Connector.java:1129)
at org.apache.catalina.core.StandardService.start(StandardService.java:540)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
i am sure no other app is using ports(8484 or 8443) as verified with Tomcat start up error. i am not sure what is the actual cause ?
我确信没有其他应用程序正在使用端口(8484 或 8443),经Tomcat 启动错误验证。我不确定真正的原因是什么?
采纳答案by Brian Roach
port="8484"
...
redirectPort="8484"
You're attempting to open two listening sockets on the same port.
您正在尝试在同一端口上打开两个侦听套接字。
The redirectPort
is for:
的redirectPort
是:
If this Connector is supporting non-SSL requests, and a request is received for which a matching <security-constraint> requires SSL transport, Catalina will automatically redirect the request to the port number specified here.
如果此连接器支持非 SSL 请求,并且接收到匹配 <security-constraint> 需要 SSL 传输的请求,Catalina 将自动将请求重定向到此处指定的端口号。
It would need to be a differentport than the one specified by port
它需要与指定的端口不同port