1. 程式人生 > >SpringBoot bug 記錄 無法啟動專案

SpringBoot bug 記錄 無法啟動專案

廢話不多說 先上BUG日誌
 

[INFO ] 2018-08-22 10:42:47,742 --main-- [springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator] Generating unique operation named: queryOrgTreeUsingPOST_1 
[INFO ] 2018-08-22 10:42:47,862 --main-- [org.apache.coyote.http11.Http11NioProtocol] Initializing ProtocolHandler ["http-nio-172.30.200.50-8080"] 
[INFO ] 2018-08-22 10:42:47,876 --main-- [org.apache.coyote.http11.Http11NioProtocol] Starting ProtocolHandler ["http-nio-172.30.200.50-8080"] 
[ERROR] 2018-08-22 10:42:47,882 --main-- [org.apache.catalina.core.StandardService] Failed to start connector [Connector[HTTP/1.1-8080]] 
org.apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-8080]]
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
	at org.apache.catalina.core.StandardService.addConnector(StandardService.java:225)
	at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.addPreviouslyRemovedConnectors(TomcatEmbeddedServletContainer.java:250)
	at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.start(TomcatEmbeddedServletContainer.java:193)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.startEmbeddedServletContainer(EmbeddedWebApplicationContext.java:297)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:145)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
	at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)
	at com.zdkj.operation.OperationEPApplication.main(OperationEPApplication.java:15)
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
	at org.apache.catalina.connector.Connector.startInternal(Connector.java:1021)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	... 13 common frames omitted
Caused by: java.net.BindException: Cannot assign requested address: bind
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Net.java:433)
	at sun.nio.ch.Net.bind(Net.java:425)
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:210)
	at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1150)
	at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:591)
	at org.apache.catalina.connector.Connector.startInternal(Connector.java:1018)
	... 14 common frames omitted
[INFO ] 2018-08-22 10:42:47,894 --main-- [org.apache.coyote.http11.Http11NioProtocol] Pausing ProtocolHandler ["http-nio-172.30.200.50-8080"] 
[INFO ] 2018-08-22 10:42:47,894 --main-- [org.apache.catalina.core.StandardService] Stopping service [Tomcat] 
[INFO ] 2018-08-22 10:42:47,929 --main-- [org.apache.catalina.util.LifecycleBase] The stop() method was called on component [StandardServer[-1]] after stop() had already been called. The second call will be ignored. 
[INFO ] 2018-08-22 10:42:47,930 --main-- [org.apache.coyote.http11.Http11NioProtocol] Stopping ProtocolHandler ["http-nio-172.30.200.50-8080"] 
[INFO ] 2018-08-22 10:42:47,930 --main-- [org.apache.coyote.http11.Http11NioProtocol] Destroying ProtocolHandler ["http-nio-172.30.200.50-8080"] 
[INFO ] 2018-08-22 10:42:47,935 --main-- [org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer] 

Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled. 
[ERROR] 2018-08-22 10:42:47,940 --main-- [org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter] 

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.

 一開始沒發現問題在哪裡,就在網上找了下對應的異常類解決方法。網上的部落格都是說少了jar包。但是我這個明顯不是jar包導致的,後來懷疑是埠被佔用。換了埠號為8080,重啟專案。BUG依然存在。

後來仔細檢視日誌,發現一個IP

 感覺有問題啊,馬上檢視下本機IP 這不是我的IP地址啊。 問題大概知道了。一看springBoot的配置檔案


server.address=172.30.200.50
server.port=8080

 不知道那個哥們吧這個配置提交上GIT了。然後我這邊拉取下來就這樣。啟動springboot的時候他去把專案繫結到這個IP上。但是IP又不存在。直接導致這個異常的發生

解決方法 註釋掉這個配置server.address=172.30.200.50