通过下面的方式启动项目时发现报错了
命令: java -jar project.jar
***************************
APPLICATION FAILED TO START
***************************
Description:
Web server failed to start. Port 80 was already in use.
Action:
Identify and stop the process that's listening on port 80
or configure this application to listen on another port.
可通过 netstat 命令却查不到任何其它进程占用的提示信息. 猜测是项目内部的问题.
触发条件:
springboot 版本 2.7.8
配置端口和ssl如下:
server:
port: 80
tomcat:
max-http-header-size: 9000
ssl:
enabled: true
key-store: /project/ssl/certificate.pfx
key-store-type: PKCS12
key-store-password: 123456
解读:
项目启动日志中有这样一句日志:
Tomcat initialized with port(s): 80 (https) 80 (http)
说明本该配置ssl为443的端口却再次配置到了80
纠正:
server:
port: 443
tomcat:
max-http-header-size: 9000
ssl:
enabled: true
key-store: /project/ssl/certificate.pfx
key-store-type: PKCS12
key-store-password: 123456
这时候应该就好了