인프런 커뮤니티 질문&답변

김김희석님의 프로필 이미지
김김희석

작성한 질문수

스프링 부트 개념과 활용

SPRINGBOOT HTTPS 적용 중 에러

해결된 질문

작성

·

4.2K

0

안녕하세요.

강의를 보면서 SSL 적용중 에러가 있어서 문의드립니다.

위와 같이 keystore를 등록 후

위 사진과 같이 properties를 설정하여 https를 적용 시키려고하는데 

Failed to start bean 'webServerStartStop' 이라는 에러가 발생하면서 실행이 되지않습니다.

구글링을 해보고 있는데 별다른 해결책이안보여서 혹시 제가 놓친 부분이 있는건지.. 아니면 무언가를 추가해야하는건지 궁금합니다..

로그상를 봤을때는 password가 incorrect라고 나오는데 keytool -v -list -keystore ..로 확인시 해당 패스워드로 확인이 되었습니다.

jdk 1.8을 사용중에 있습니다.

--- CONSOLE LOG ---

error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.

2020-11-18 00:09:31.709 ERROR 17520 --- [           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.1.jar:5.3.1]

at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.1.jar:5.3.1]

at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.1.jar:5.3.1]

at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_261]

at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.1.jar:5.3.1]

at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.1.jar:5.3.1]

at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:942) ~[spring-context-5.3.1.jar:5.3.1]

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591) ~[spring-context-5.3.1.jar:5.3.1]

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.0.jar:2.4.0]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) [spring-boot-2.4.0.jar:2.4.0]

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) [spring-boot-2.4.0.jar:2.4.0]

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) [spring-boot-2.4.0.jar:2.4.0]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) [spring-boot-2.4.0.jar:2.4.0]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1309) [spring-boot-2.4.0.jar:2.4.0]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1298) [spring-boot-2.4.0.jar:2.4.0]

at me.survivalking.springstudy1.Springstudy1Application.main(Springstudy1Application.java:12) [classes/:na]

Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server

at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229) ~[spring-boot-2.4.0.jar:2.4.0]

at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) ~[spring-boot-2.4.0.jar:2.4.0]

at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.1.jar:5.3.1]

... 15 common frames omitted

Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed

at org.apache.catalina.core.StandardService.addConnector(StandardService.java:231) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) ~[spring-boot-2.4.0.jar:2.4.0]

at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213) ~[spring-boot-2.4.0.jar:2.4.0]

... 17 common frames omitted

Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed

at org.apache.catalina.connector.Connector.startInternal(Connector.java:1067) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

... 19 common frames omitted

Caused by: java.lang.IllegalArgumentException: keystore password was incorrect

at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:99) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:216) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1141) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1227) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:592) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.catalina.connector.Connector.startInternal(Connector.java:1064) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

... 21 common frames omitted

Caused by: java.io.IOException: keystore password was incorrect

at sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2068) ~[na:1.8.0_261]

at java.security.KeyStore.load(KeyStore.java:1445) ~[na:1.8.0_261]

at org.apache.tomcat.util.security.KeyStoreUtil.load(KeyStoreUtil.java:67) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:216) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore(SSLHostConfigCertificate.java:207) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers(SSLUtilBase.java:282) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:246) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:97) ~[tomcat-embed-core-9.0.39.jar:9.0.39]

... 27 common frames omitted

Caused by: java.security.UnrecoverableKeyException: failed to decrypt safe contents entry: javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.

... 35 common frames omitted

답변 2

3

백기선님의 프로필 이미지
백기선
지식공유자

https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81%EB%B6%80%ED%8A%B8/lecture/13527?tab=curriculum

잘 찾으셨네요. 위 수업에서 다루고 있지만 key-password가 아니라 key-store-password를 사용해야 합니다.

0

김김희석님의 프로필 이미지
김김희석
질문자

해결 하였습니다.

server.ssl.key-store-password=123456

properties에 위코드 입력시 정상 적용됩니다.

김김희석님의 프로필 이미지
김김희석

작성한 질문수

질문하기