1、解決Web server failed to start. Port 8080 was already in use
2、SpringBoot啟動(dòng)報(bào)錯(cuò):“Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.”
3、Failed to start end point associated with ProtocolHandler [http-nio-8080]
4、Failed to start connector [Connector[HTTP/1.1-8080]]
前言
提示:這里可以添加本文要記錄的大概內(nèi)容:
各種錯(cuò)誤千千萬,一個(gè)項(xiàng)目遇一半
其實(shí)以前遇到過這個(gè)錯(cuò)誤,但沒把它記錄下來,今天又遇到了就把它寫一下
問題描述
項(xiàng)目場景一:
springboot啟動(dòng)報(bào)錯(cuò):“Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.”
這里我有點(diǎn)蒙了,以為是配置或者版本問題
直到我看到下面:Web server failed to start. Port 8080 was already in use
Identify and stop the process that 's listening on port 8088 or configure this application to listen on another port.
這不還是端口被占用嗎 ,建議我停止這個(gè)端口,或者改個(gè)端口
項(xiàng)目場景二:
?
Failed to start end point associated with ProtocolHandler [http-nio-8080]
錯(cuò)誤原因:Tomcat 端口被占用
被占用的端口號是 8080
解決方案
第一種:關(guān)掉被占用端口
第一步:查看tomcat的所使用的端口
【win+r】輸入【cmd】打開運(yùn)行框
輸入:
netstat -ano|findstr 8080
請根據(jù)實(shí)際情況填寫,我這里被占用的端口號是8080
?
此處的 “10320” 為占用端口的進(jìn)程號
第二步:殺死占用端口的進(jìn)程
輸入:
taskkill /pid 10320 /f
10320就不要復(fù)制了 ,要寫你自己的進(jìn)程
?
可以看到現(xiàn)在進(jìn)程已被殺死,如果進(jìn)程無法殺死
那就在啟動(dòng) cmd 的時(shí)候用管理員身份打開,再操作一遍就好
回到項(xiàng)目再運(yùn)行一遍:
項(xiàng)目運(yùn)行成功
?
第二種:改端口號
Spring Boot的配置文件主要有兩種格式,分別為application.properties 和 application.yml ,它們的區(qū)別主要有以下兩點(diǎn):
(1)、書寫格式不同,比如同樣是指定端口為8080,在兩種配置文件中寫法是不一樣的,具體如下:
我們一般在application.properties中添加,通常情況下會把a(bǔ)pplication.properties改為:application.yaml
打開后在里面輸入:(port 冒號后有空格)
server:
port: 8080
如果是application.properties寫法:
server.port=8080
兩種寫法,根據(jù)自己實(shí)際情況任選其一
(2) 、application.yml 格式不支持 @PropertySource 注解導(dǎo)入配置。
當(dāng)然你說我想看我這著個(gè)程序用的哪個(gè)端口號,你在運(yùn)行后看倒數(shù)第二行:
?
第三種:任務(wù)管理器關(guān)掉Java進(jìn)程
打開任務(wù)管理器關(guān)掉Java進(jìn)程,鼠標(biāo)右鍵或者右下角結(jié)束任務(wù)都行
第四種
或者用下面截圖這種辦法也行,原理跟第一種一樣文章來源:http://www.zghlxwxcb.cn/news/detail-546337.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-546337.html
到了這里,關(guān)于Failed to start connector [Connector[HTTP/1.1-8080]]的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!