問(wèn)題
? ? ? ? 在win10電腦上啟動(dòng)SpringBoot項(xiàng)目出現(xiàn)以下報(bào)錯(cuò)
org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
? ? ? ? at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:185) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
? ? ? ? at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:53) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
? ? ? ? at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:360) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
? ? ? ? at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:158) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
? ? ? ? at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:122) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
? ? ? ? at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:895) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
? ? ? ? at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:554) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
? ? ? ? at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at com.zw.msuite.MsuiteApplication.main(MsuiteApplication.java:22) [classes!/:1.0.0]
? ? ? ? at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_202]
? ? ? ? at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [msuite-service-1.0.0.jar:1.0.0]
? ? ? ? at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) [msuite-service-1.0.0.jar:1.0.0]
? ? ? ? at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [msuite-service-1.0.0.jar:1.0.0]
? ? ? ? at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [msuite-service-1.0.0.jar:1.0.0]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
? ? ? ? at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:182) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
? ? ? ? ... 22 common frames omitted
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
? ? ? ? at org.apache.catalina.core.StandardService.addConnector(StandardService.java:231) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
? ? ? ? ... 24 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
? ? ? ? at org.apache.catalina.connector.Connector.startInternal(Connector.java:1067) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? ... 26 common frames omitted
Caused by: java.io.IOException: Unable to establish loopback connection
? ? ? ? at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at sun.nio.ch.PipeImpl$Initializer.run(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_202]
? ? ? ? at sun.nio.ch.PipeImpl.<init>(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at sun.nio.ch.SelectorProviderImpl.openPipe(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at java.nio.channels.Pipe.open(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at sun.nio.ch.WindowsSelectorImpl.<init>(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at sun.nio.ch.WindowsSelectorProvider.openSelector(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at java.nio.channels.Selector.open(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector(NioSelectorPool.java:52) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? at org.apache.tomcat.util.net.NioSelectorPool.close(NioSelectorPool.java:119) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:346) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1146) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1227) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:592) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? at org.apache.catalina.connector.Connector.startInternal(Connector.java:1064) ~[tomcat-embed-core-9.0.38.jar!/:9.0.38]
? ? ? ? ... 28 common frames omitted
Caused by: java.net.ConnectException: Connection timed out: connect
? ? ? ? at sun.nio.ch.Net.connect0(Native Method) ~[na:1.8.0_202]
? ? ? ? at sun.nio.ch.Net.connect(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at sun.nio.ch.Net.connect(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at sun.nio.ch.SocketChannelImpl.connect(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at java.nio.channels.SocketChannel.open(Unknown Source) ~[na:1.8.0_202]
? ? ? ? at sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(Unknown Source) ~[na:1.8.0_202]
問(wèn)題定位和解決
? ? ? ? 在上述報(bào)錯(cuò)中,標(biāo)紅的那一行是至關(guān)重要的報(bào)錯(cuò)信息。
Caused by: java.io.IOException: Unable to establish loopback connection
? ? ?? ?翻譯為中文:不能建立環(huán)回連接。而回環(huán)地址就是指127.0.0.1。后來(lái)想到可能跟我本機(jī)配置的IP安全策略有關(guān)。有關(guān)安全策略的配置見(jiàn)下面博客。
Windows 10 布置IP安全策略_李劭卓保護(hù)美好一切的博客-CSDN博客_windows ip安全策略
? ? ? ? 我在一條安全策略中,啟用了一個(gè)"All Deny"的IP篩選器,該篩選器會(huì)禁用所有IP訪問(wèn)我的電腦,并放在篩選器列表的最后生效,作為兜底。
? ? ? ? 關(guān)鍵在于這個(gè)"All Deny"的IP篩選器的目標(biāo)地址,我配置了"任何IP地址"(如下圖),這就導(dǎo)致了環(huán)回地址(127.0.0.1)也不能被訪問(wèn)。將目標(biāo)地址更改為"我的IP地址"之后,上述報(bào)錯(cuò)就消失了,服務(wù)能夠正常啟動(dòng)。
文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-408715.html
?文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-408715.html
到了這里,關(guān)于java.io.IOException: Unable to establish loopback connection的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!