Невозможно запустить загрузочное приложение Spring с использованием SSL - PullRequest
0 голосов
/ 26 октября 2019

Я не могу запустить приложение весенней загрузки с https. Я знаю, что Spring boot использует встроенный tomcat-сервер

. Ниже приведена трассировка стека

org.apache.catalina.LifecycleException: Protocol handler start failed
    at org.apache.catalina.connector.Connector.startInternal(Connector.java:1008) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.26.jar!/:9.0.26]
    at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227) [tomcat-embed-core-9.0.26.jar!/:9.0.26]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:263) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]
    at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:195) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:297) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:552) [spring-context-5.1.10.RELEASE.jar!/:5.1.10.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:744) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:391) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:312) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204) [spring-boot-2.1.9.RELEASE.jar!/:2.1.9.RELEASE]
    at com.leapanalysis.apis.application.LAApplication.main(LAApplication.java:33) [classes!/:0-SNAPSHOT]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_222]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_222]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_222]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_222]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [apis.jar:0-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [apis.jar:0-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [apis.jar:0-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [apis.jar:0-SNAPSHOT]
 but has failed to stop it. This is very likely to create a memory leak. Stack trace of
APPLICATION FAILED TO START
Description
The Tomcat connector configured to listen on port 8181 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 8181, or configure this application to listen on another port.

Ниже показан мой файл Yaml

server:
  port: 8181
  ssl:
    enabled: true
    key-alias: tomcat
    key-password: tomcat
    key-store-password: tomcat
    key-store: classpath:keystore.p12
    key-store-type: PKCS12

Я попробовал почти все ответыв стеке потокаВот некоторые из ответов, которые я попробовал:

Это происходит только при запуске файла JAR, я могу легко запустить приложение весенней загрузки из IDE (я использую Intellij)

  • Изменен порт с 81818443 (многие другие также)
  • явно указанный порт сервера при запуске файла JAR (java -jar --server.port = 8661)

  • создано ипробовал файлы JKS и PKCS12 (не повезло)

  • Я проверил, работает ли какое-либо другое приложение в порту с помощью netsat -nltp |grep: (здесь нет ни одного приложения) - проверил ту же команду в корне, ничего не отображается

  • Это происходит только при указании файла ssl, если подробности ssl не указанытам в файле yaml приложение легко запускается.

Любая помощь приветствуется. Заранее спасибо

1 Ответ

1 голос
/ 29 октября 2019

Я наконец решил эту проблему! Это была проблема со встроенной версией tomcat (9.0.25), которая используется в весенней загрузке версии 2.1.9.RELEASE.

Я понижен до весенней загрузки 2.1.8.RELEASE, и она работает. Подробнее здесь: https://github.com/spring-projects/spring-boot/issues/18505

...