New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[native-image] SSLContext reflective instantation fails #390

Closed
lbialy opened this Issue May 1, 2018 · 4 comments

Comments

3 participants
@lbialy

lbialy commented May 1, 2018

Hello again, I've found another problem with native-image tool related to reflection I guess. When I compile http4s-blaze-client package with native-image I get:

java.security.NoSuchAlgorithmException: class configured for SSLContext (provider: SunJSSE) cannot be found.
        at java.lang.Throwable.<init>(Throwable.java:287)
        at java.lang.Exception.<init>(Exception.java:84)
        at java.security.GeneralSecurityException.<init>(GeneralSecurityException.java:71)
        at java.security.NoSuchAlgorithmException.<init>(NoSuchAlgorithmException.java:72)
        at java.security.Provider$Service.getImplClass(Provider.java:1649)
        at java.security.Provider$Service.newInstance(Provider.java:1592)
        at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
        at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
        at javax.net.ssl.SSLContext.getInstance(SSLContext.java:156)
        at javax.net.ssl.SSLContext.getDefault(SSLContext.java:96)
        at org.http4s.client.blaze.Http1Support.$anonfun$sslContext$1(Http1Support.scala:32)
        at org.http4s.client.blaze.Http1Support$$Lambda$12206/202650241.apply(Unknown Source)
        at scala.Option.getOrElse(Option.scala:121)
        at org.http4s.client.blaze.Http1Support.<init>(Http1Support.scala:32)
        at org.http4s.client.blaze.Http1Support$.apply(Http1Support.scala:23)
        at org.http4s.client.blaze.Http1Client$.mkClient(Http1Client.scala:24)
        at org.http4s.client.blaze.Http1Client$.$anonfun$apply$1(Http1Client.scala:17)

Missing class in question is sun.security.ssl.SSLContextImpl. Is providing a shim the only way to work around this class of problems?

@cstancu

This comment has been minimized.

Member

cstancu commented May 1, 2018

@lbialy support for the Java security packages is currently under development. There is no workaround for it at this point.

@cstancu cstancu added the substrate label May 1, 2018

@lbialy

This comment has been minimized.

lbialy commented May 3, 2018

Workaround that works if you don't actually use https:

  class DummySSLContext(spi: SSLContextSpi, provider: Provider, s: String) extends SSLContext(spi, provider, s) {
  }

  private def sslContext: SSLContext = new DummySSLContext(null, null, null)
@danielnorberg

This comment has been minimized.

danielnorberg commented May 23, 2018

Really looking forward to compiling our cli with native-image when ssl/https support lands. Any updates on when it might be implemented or any pointers on how to contribute to make this work?

@cstancu cstancu added the feature label Jun 22, 2018

@maizy maizy referenced this issue Jul 8, 2018

Open

AWS S3 SDK support #5

6 of 9 tasks complete
@cstancu

This comment has been minimized.

Member

cstancu commented Sep 18, 2018

This should be fixed in 76d0435 which adds support for HTTPS and JCA security services. You need to run native-image with --enable-https or --enable-url-protocols=https. These features will be available in the rc7 realease. See URL-PROTOCOLS.md and JCA-SECURITY-SERVICES.md for details.

@cstancu cstancu closed this Sep 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment