μLink 2023-11-18 11:48 采纳率: 35.3%
浏览 58
已结题

Springboot 配置SSL后编译报错

springboot工程默认http 可以正常编译启动,添加腾讯云SSL证书配置后,编译报错:
.jks文件放置在resource 路径,yam文件增加ssl 配置后报错:


```yaml
 ssl:
    key-store: classpath:xiaoxxxx.cn.jks
    key-password: a0xl0m8fa860v4
    key-store-type: JKS

报错:2023-11-18 11:35:24.610  INFO 9608 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1496 ms
 _ _   |_  _ _|_. ___ _ |    _ 
| | |\/|_)(_| | |_\  |_)||_|_\ 
     /               |         
                        3.4.0 
2023-11-18 11:35:26.262  WARN 9608 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
2023-11-18 11:35:26.283  INFO 9608 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2023-11-18 11:35:26.296  INFO 9608 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-11-18 11:35:26.320 ERROR 9608 --- [           main] o.s.boot.SpringApplication               : Application run failed

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:181) ~[spring-context-5.3.13.jar:5.3.13]
    at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.13.jar:5.3.13]
    at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.13.jar:5.3.13]
    at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_271]
    at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.13.jar:5.3.13]
    at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.13.jar:5.3.13]
    at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.13.jar:5.3.13]


![img](https://img-mid.csdnimg.cn/release/static/image/mid/ask/071261972007174.png "#left")
  • 写回答

22条回答 默认 最新

  • 叫兽-郭老师 新星创作者: Java技术领域 2023-11-18 12:53
    关注
    获得0.45元问题酬金

    没看懂你操作,你是想要https访问springboot项目?

    如果你的springboot项目部署在服务器山,那么只需要将域名绑定服务器ip,然后通过nginx监听443端口,配置ssl默认,配置上证书。然后https访问即可。

    如果没有证书,只有服务器ip,你也想用https://ip:端口号形式访问,也可以通过nginx配置。

    评论 编辑记录

报告相同问题?

问题事件

  • 系统已结题 11月26日
  • 赞助了问题酬金15元 11月18日
  • 创建了问题 11月18日