【tomcat】启动报错:Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"] java.lang.Exception: Socket bind failed 和java.net.BindException: Address already in use: JVM_Bind错误解决

时间:2022-05-24 11:41:34

背景:【新手】

将开发机子上的Tomcat连同其中的项目,一起拷贝到服务器上,启动tomcat的start.bat,然后报错如下:

问题1:

Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"]
java.lang.Exception: Socket bind failed: [730048] ?????????×???(Э?é/???????/???)????í??
at org.apache.tomcat.util.net.AprEndpoint.bind(AprEndpoint.java:408)
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:482)
at org.apache.coyote.AbstractProtocolHandler.init(AbstractProtocolHandler.java:355)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:910)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:559)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:781)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:101)
at org.apache.catalina.startup.Catalina.load(Catalina.java:572)
at org.apache.catalina.startup.Catalina.load(Catalina.java:595)
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.load(Bootstrap.java:262)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:430)
2011-10-10 17:48:41 org.apache.catalina.core.StandardService initInternal
严重: Failed to initialize connector [Connector[HTTP/1.1-8080]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:912)
信息: Initializing ProtocolHandler ["ajp-apr-8009"]
2011-10-10 17:48:41 org.apache.coyote.AbstractProtocolHandler init
严重: Failed to initialize end point associated with ProtocolHandler ["ajp-apr-8009"]
java.lang.Exception: Socket bind failed: [730048] ?????????×???(Э?é/???????/???)????í??
严重: Failed to initialize connector [Connector[AJP/1.3-8009]]
org.apache.catalina.LifecycleException: Protocol handler initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:912)

Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"]
java.lang.Exception: Socket bind failed: [730048] ?????????×???(Э?é/???????/???)????í??

严重: Failed to initialize connector [Connector[HTTP/1.1-8080]]

严重: Failed to initialize connector [Connector[AJP/1.3-8009]]

这些错误的核心!

分析问题:

发生这类型错误,在启动tomcat的时候,就预测到了,服务器上原本就有一个tomcat6.0,那个tomcat也在启动运行中,避免端口占用,更改了新的tomcat下的conf文件中的server.xml中的端口配置

解决问题:

【tomcat】启动报错:Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"] java.lang.Exception: Socket bind failed  和java.net.BindException: Address already in use: JVM_Bind错误解决

【tomcat】启动报错:Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"] java.lang.Exception: Socket bind failed  和java.net.BindException: Address already in use: JVM_Bind错误解决

【tomcat】启动报错:Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"] java.lang.Exception: Socket bind failed  和java.net.BindException: Address already in use: JVM_Bind错误解决

将这三个位置的端口号都改变,如果还报相同的错误,说明端口号依然被占用,注意错误中明显的错误:

类似于这样--->Failed to initialize connector [Connector[AJP/1.3-8009]]

那就更改相应位置的端口号。

直到所有的位置都更改正确可以正常启动即可。

错误2:

上面的问题解决完成后,启动tomcat,又是闪退,盯着错误出现的时候,瞬间定住滚动条,截图如下错误

java.net.BindException: Address already in use: JVM_Bind

【tomcat】启动报错:Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"] java.lang.Exception: Socket bind failed  和java.net.BindException: Address already in use: JVM_Bind错误解决

分析问题:

不是端口占用已经解决了么,项目都启动完成了,为什么还会有类似的错误出现?

解决问题:

---->在Ctrl+R进入运行,cmd进入命令窗口

---->输入netstat -ao

---->查看各个端口的占用情况和这个端口的PID

【tomcat】启动报错:Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"] java.lang.Exception: Socket bind failed  和java.net.BindException: Address already in use: JVM_Bind错误解决

---->然后找到你tomcat中的那三个端口号,在这里已经出现的,也就是被占用的进程,对应最后一列的PID号

---->然后记住PID号,进入服务器的任务管理器,进入性能页的资源监视器,点击资源监视器中的CPU选项卡,对比PID号找到那个占用了端口的进程

【tomcat】启动报错:Failed to initialize end point associated with ProtocolHandler ["http-apr-8080"] java.lang.Exception: Socket bind failed  和java.net.BindException: Address already in use: JVM_Bind错误解决

---->查找到对应的进程后,如果本进程没有多大用,就直接干掉他,要是有用--没办法,自己回去把自己tomcat中的那个被人家占用的端口号改成其他没有被用的端口号

---->更改完成之后,重新启动自己的tomcat,就可以启动成功了