Skip to content
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
Closed

[native-image] SSLContext reflective instantation fails #390

lbialy opened this issue May 1, 2018 · 4 comments

Comments

@lbialy
Copy link

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
Copy link
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.

@lbialy
Copy link
Author

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
Copy link

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
Copy link
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 as completed Sep 18, 2018
zakkak added a commit to zakkak/mandrel that referenced this issue Jun 16, 2022
zakkak added a commit to zakkak/mandrel that referenced this issue Jun 16, 2022
quarkusio/quarkus#25986 allows Quarkus native to
work with the image-builder running on module path.

Reverts: oracle#388, oracle#390, oracle#391

Closes: oracle#389
zakkak added a commit to zakkak/mandrel that referenced this issue Jun 20, 2022
quarkusio/quarkus#25986 allows Quarkus native to
work with the image-builder running on module path.

Reverts: oracle#388, oracle#390, oracle#391

Closes: oracle#389
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants