Re: tomcat-embed-core-8.5.29 Http11NioProtocol stopped accepting protocol as part of keystore file path

2018-04-24 Thread Mark Thomas
On 23/04/18 14:10, Maksym Mazur wrote:
>  HI everyone
> 
> TL;DR
> After upgrade from tomcat 8.5.23 to 8.5.29 Http11NioProtocol fails to
> recognize "classpath" as protocol to load keystore file.
> Using java 1.8.0_171, OS: Windows 10

Support for the classpath protocol is provided by Spring Boot. I don't
see any recent changes in the relevant Tomcat code so I'd ask the Spring
team to start with.

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



tomcat-embed-core-8.5.29 Http11NioProtocol stopped accepting protocol as part of keystore file path

2018-04-23 Thread Maksym Mazur
 HI everyone

TL;DR
After upgrade from tomcat 8.5.23 to 8.5.29 Http11NioProtocol fails to
recognize "classpath" as protocol to load keystore file.
Using java 1.8.0_171, OS: Windows 10

In my project I used Spring Boot 2.0.0.M7 which has
tomcat-embed-core-8.5.23 dependency.
I have code to read keystore file location from application.yml property,
and use it create ssl connector.

property in yml:

ssl:
  keystoreFile: classpath:.keystore

connector creation code:

Connector connector = new Connector("org.apache.coyote.
http11.Http11NioProtocol");
Http11NioProtocol protocol = (Http11NioProtocol)
connector.getProtocolHandler();
protocol.setKeystoreFile(sslProperties.getKeystoreFile());

where sslProperties.getKeystoreFile() evaluates to "classpath:.keystore"
during runtime.

And this worked fine, until I updated Spring Boot to 2.0.1, which has
tomcat-embed-core-8.5.29 in it.
Now starting tomcat fails with later exception:

org.apache.catalina.LifecycleException: Failed to initialize component
[Connector[HTTP/1.1-8443]]
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112)
at org.apache.catalina.core.StandardService.initInternal(
StandardService.java:549)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
at org.apache.catalina.core.StandardServer.initInternal(
StandardServer.java:875)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140)
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:367)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(
TomcatWebServer.java:107)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(
TomcatWebServer.java:86)
at org.springframework.boot.web.embedded.tomcat.
TomcatServletWebServerFactory.getTomcatWebServer(
TomcatServletWebServerFactory.java:409)
at org.springframework.boot.web.embedded.tomcat.
TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.
java:174)
at org.springframework.boot.web.servlet.context.
ServletWebServerApplicationContext.createWebServer(
ServletWebServerApplicationContext.java:179)
at org.springframework.boot.web.servlet.context.
ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationCon
text.java:152)
at org.springframework.context.support.AbstractApplicationContext.refresh(
AbstractApplicationContext.java:544)
at org.springframework.boot.web.servlet.context.
ServletWebServerApplicationContext.refresh(ServletWebServerApplicationCon
text.java:140)
at org.springframework.boot.SpringApplication.refresh(
SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(
SpringApplication.java:395)
at org.springframework.boot.SpringApplication.run(
SpringApplication.java:327)
at org.springframework.boot.builder.SpringApplicationBuilder.run(
SpringApplicationBuilder.java:137)
at net.twisteddna.Application.main(Application.java:37)
Caused by: org.apache.catalina.LifecycleException: Protocol handler
initialization failed
at org.apache.catalina.connector.Connector.initInternal(Connector.java:995)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107)
... 19 common frames omitted
Caused by: java.lang.IllegalArgumentException: unknown protocol: classpath
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(
AbstractJsseEndpoint.java:116)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(
AbstractJsseEndpoint.java:87)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:225)
at org.apache.tomcat.util.net.AbstractEndpoint.init(
AbstractEndpoint.java:1086)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.init(
AbstractJsseEndpoint.java:268)
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:581)
at org.apache.coyote.http11.AbstractHttp11Protocol.init(
AbstractHttp11Protocol.java:68)
at org.apache.catalina.connector.Connector.initInternal(Connector.java:993)
... 20 common frames omitted
Caused by: java.net.MalformedURLException: unknown protocol: classpath
at java.net.URL.(URL.java:600)
at java.net.URL.(URL.java:490)
at java.net.URL.(URL.java:439)
at java.net.URI.toURL(URI.java:1089)
at org.apache.tomcat.util.file.ConfigFileLoader.getInputStream(
ConfigFileLoader.java:95)
at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:132)
at org.apache.tomcat.util.net.SSLHostConfigCertificate.
getCertificateKeystore(SSLHostConfigCertificate.java:204)
at org.apache.tomcat.util.net.jsse.JSSEUtil.getKeyManagers(
JSSEUtil.java:184)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(
AbstractJsseEndpoint.java:114)
... 27 common frames omitted