I am trying to convert from http to https in my serverSo I created self-signed certificate using keytool in jdk 17 and this is the version I use to run my serverThis is the command I use to generate the certificatekeytool -genkeypair -alias tdf -keyalg RSA -keysize 2048 -storetype PKCS12 -keystore tdf.p12 -validity 3650
and I added it in the resources path to be accessed through classpathand this is my configuration in the properties file
server.ssl.enabled=trueserver.ssl.key-store-type=PKCS12server.ssl.key-store=classpath:tdf.p12server.ssl.key-store-password=password
But I faced this exception when the tomcat server trying to attach connector with Tls to it
2024-08-15 09:58:23 ERROR o.s.boot.SpringApplication - Application run failedorg.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:182) at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:357) at java.base/java.lang.Iterable.forEach(Iterable.java:75) at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:156) at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:124) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:946) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:594) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:409) at org.springframework.boot.SpringApplication.run(SpringApplication.java:308) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1289) at com.ejada.tdf.requests.management.TDFRequestsManagementApisApplication.main(TDFRequestsManagementApisApplication.java:23)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) at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:179) ... 14 common frames omittedCaused by: java.lang.IllegalArgumentException: standardService.connector.startFailed at org.apache.catalina.core.StandardService.addConnector(StandardService.java:235) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213) ... 16 common frames omittedCaused by: org.apache.catalina.LifecycleException: Protocol handler start failed at org.apache.catalina.connector.Connector.startInternal(Connector.java:1042) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171) at org.apache.catalina.core.StandardService.addConnector(StandardService.java:232) ... 18 common frames omittedCaused by: java.lang.IllegalArgumentException: Tag number over 30 is not supported at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:107) at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71) at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:236) at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1332) at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1418) at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:665) at org.apache.catalina.connector.Connector.startInternal(Connector.java:1039) ... 20 common frames omittedCaused by: java.io.IOException: Tag number over 30 is not supported at java.base/sun.security.util.DerValue.<init>(DerValue.java:442) at java.base/sun.security.util.DerValue.<init>(DerValue.java:487) at java.base/sun.security.pkcs12.PKCS12KeyStore.engineLoad(PKCS12KeyStore.java:2012) at java.base/sun.security.util.KeyStoreDelegator.engineLoad(KeyStoreDelegator.java:221) at java.base/java.security.KeyStore.load(KeyStore.java:1473) at org.apache.tomcat.util.security.KeyStoreUtil.load(KeyStoreUtil.java:67) at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:240) at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore(SSLHostConfigCertificate.java:237) at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers(SSLUtilBase.java:308) at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:268) at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:105) ... 26 common frames omitted
I tried to change the type of the certificate to JKS but same issue happens alsoand checked that the certificate not corrupted using KeyStore Explorer app and I created also dummy project and added this certificate to it and it's successfully running