在 https 之后启动:配置为侦听端口 8444 的 Tomcat 连接器无法启动。
2022-09-04 01:03:55
我按照指南在Spring Boot中启用https。该应用程序事先正在处理 https://localhost:8080
我已经创建了一个与我的,它现在看起来像:keystore.jks
application.properties
# Define a custom port instead of the default 8080
server.port = 8444
# Tell Spring Security (if used) to require requests over HTTPS
security.require-ssl=true
# The format used for the keystore
server.ssl.key-store-type:PKCS12
# The path to the keystore containing the certificate
server.ssl.key-store=keystore.p12
# The password used to generate the certificate
server.ssl.key-store-password=<somepassword>
# The alias mapped to the certificate
server.ssl.key-alias=tomcat
现在,如果我运行 main 方法来启动 spring boot 应用,它会抛出:
Description:
The Tomcat connector configured to listen on port 8444 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 8444, or configure this application to listen on another port.
端口未在使用中,因此一定是配置错误?
我不确定要改变什么。这是一个简单的SPA应用程序,Spring只提供一个索引.html并具有单个REST端点。在这种情况下,tomcat/spring应该如何配置为接受https,并在启动时没有错误?