初次使用IntelliJ IDEA,在配置tomcat后,启动报下面异常
信息: Command line argument: (x86)\java\servers\apache-tomcat-7.0.79\temp 2017-8-10 19:55:50 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["http-bio-8080"] 2017-8-10 19:55:50 org.apache.coyote.AbstractProtocol init 信息: Initializing ProtocolHandler ["ajp-bio-1099"] 2017-8-10 19:55:50 org.apache.coyote.AbstractProtocol init 严重: Failed to initialize end point associated with ProtocolHandler ["ajp-bio-1099"] java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365) at java.net.ServerSocket.bind(ServerSocket.java:319) at java.net.ServerSocket.<init>(ServerSocket.java:185) at java.net.ServerSocket.<init>(ServerSocket.java:141) at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49) at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:400) at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:715) at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:452) at org.apache.catalina.connector.Connector.initInternal(Connector.java:978) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) at org.apache.catalina.core.StandardService.initInternal(StandardService.java:560) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:840) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) at org.apache.catalina.startup.Catalina.load(Catalina.java:643) at org.apache.catalina.startup.Catalina.load(Catalina.java:668) 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.load(Bootstrap.java:253) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:427) 2017-8-10 19:55:50 org.apache.catalina.core.StandardService initInternal 严重: Failed to initialize connector [Connector[AJP/1.3-1099]] org.apache.catalina.LifecycleException: Failed to initialize component [Connector[AJP/1.3-1099]] at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107) at org.apache.catalina.core.StandardService.initInternal(StandardService.java:560) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:840) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) at org.apache.catalina.startup.Catalina.load(Catalina.java:643) at org.apache.catalina.startup.Catalina.load(Catalina.java:668) 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.load(Bootstrap.java:253) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:427) Caused by: org.apache.catalina.LifecycleException: Protocol handler initialization failed at org.apache.catalina.connector.Connector.initInternal(Connector.java:980) at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102) ... 12 more Caused by: java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365) at java.net.ServerSocket.bind(ServerSocket.java:319) at java.net.ServerSocket.<init>(ServerSocket.java:185) at java.net.ServerSocket.<init>(ServerSocket.java:141) at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:49) at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:400) at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:715) at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:452) at org.apache.catalina.connector.Connector.initInternal(Connector.java:978) ... 13 more 2017-8-10 19:55:50 org.apache.catalina.startup.Catalina load 信息: Initialization processed in 455 ms 2017-8-10 19:55:50 org.apache.catalina.core.StandardService startInternal 信息: Starting service Catalina 2017-8-10 19:55:50 org.apache.catalina.core.StandardEngine startInternal
很明显是端口冲突。但是我本地没起其他服务,不会有端口占用。
然后查是否真的端口被占用,
在开始-运行,输入CMD打开命令行界面,输入命令
netstat -ano | findstr "1099"
查出来也是没有1099端口占用的情况。
然后一直百度查各种解决方案,大部分查出来都是怎样处理端口冲突:
一:更改服务器的端口号;
二:关闭占用当前端口的进程
我也尝试跟着百度提供的解决方案,找占用端口,修改端口,杀进程等待,但是没起作用都是报这个错误。
这时,我觉得不是其他程序端口占用的问题,应该tomcat配置有问题。
这有两个地方配置了“1099”。我试着把端口配置更大数据,还是报一样的异常。
最后怀疑是两个端口一致,起服务时候已经起了JMX1099端口,接着在起AJP1099,则冲突了。
试着把其中一个改为“1098”,再起服务,不报这个错了。
这个问题纠结一个下午,最终解决了。把整个解决过程写出来是为了后来者少踩点坑。
时间: 2024-10-26 23:10:44