quarkus: Native Image SSL Problem
Although I have followed all the directions in the documentations(https://quarkus.io/guides/native-and-ssl-guide) I am getting an annoying warning and error at the end of my microprofile rest client to the service with SSL(only in native image, not in development):
WARNING: The sunec native library, required by the SunEC provider, could not be loaded.
Caused by: java.lang.UnsatisfiedLinkError: sun.security.ec.ECKeyPairGenerator.generateECKeyPair(I[B[B)[Ljava/lang/Object; [symbol: Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair or Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair__I_3B_3B]
I had followed these steps to produce the native image:
mvn package -Pnative -Dnative-image.docker-build=true docker build -f src/main/docker/Dockerfile.native -t dockerrepo.company.com/appTodo docker run -i --rm -p 8080:8080 dockerrepo.company.com/appTodo
And I put all the SSL configuration that I can find from the documentations in the maven plugin:
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<configuration>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
<enableJni>true</enableJni>
<enableAllSecurityServices>true</enableAllSecurityServices>
</configuration>
</execution>
</executions>
</plugin>
Any additional steps did I miss?
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 40 (15 by maintainers)
Any news ?
Thanks @jamesfalkner. Your dockerfile worked for me.
I’m using quarkus-amazon-lambda extension and quarkus-amazon-dynamodb extension to access DynamoDB from AWS Lambda with custom runtime (I mean, native-image), and getting the same error:
https://github.com/kdnakt/quarkus-sandbox/tree/master/quarkus-lambda-dynamodb
It doesn’t work for the maven plugin as well. In the documentation https://quarkus.io/guides/native-and-ssl I see
So, I expect to get a native app with included SunEC library.
However, when I execute my app I receive
FWIW this also failed for me even when using Maven.
From my experiments, it seems
-Djava.library.pathno longer has any effect - if all the*.sofiles are in the same directory as the app, it works. So here’s theDockerfileI am using:I’m using exactly this dockerfile, the only change with the example in the readme is the maven
targetfolder for the gradlebuildfolderYou need to copy the
cacertsfile and the SunEC library inside your container (see theCOPYabove, the files should be$GRAALVM_HOME/jre/lib/security/cacertsfor one and$GRAALVM_HOME/jre/lib/amd64/libsunec.soon Linux, it’s a bit different on macOS). You can copy them in your VM (I would suggest to put the .so in alib/directory).Then you need to add a
, "-Djava.library.path=./lib", -Djavax.net.ssl.trustStore=./cacerts"to yourCMD.Please report back your findings. Once we get something working, it could probably be added to the documentation.