3

如何完善 Native Image 下的 SPI 问题?

 2 years ago
source link: https://www.v2ex.com/t/798579
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

V2EX  ›  Java

如何完善 Native Image 下的 SPI 问题?

  ccde8259 · 5 小时 9 分钟前 via iPhone · 76 次点击
问题起源于一个基于 Quarkus 框架的 Demo 应用里。由于需要对内容做一个 SHA256withECDSA 的签名,引入了 bouncycastle 依赖。
在 dev 模式下用 JVM 跑就没出过事,但是打 Native Image 跑签名的时候直接提示 ClassNotFound 。进一步 DEBUG 发现,BouncyCastleProvider 使用了 SPI 的机制加载签名类,而 GraalVM 把 ClassLoader 给干碎了……
有没有遇到类似问题的大佬?求科普这类问题的解决方案……

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK