This topic created in 1744 days ago, the information mentioned may be changed or developed.
问题起源于一个基于 Quarkus 框架的 Demo 应用里。由于需要对内容做一个 SHA256withECDSA 的签名,引入了 bouncycastle 依赖。
在 dev 模式下用 JVM 跑就没出过事,但是打 Native Image 跑签名的时候直接提示 ClassNotFound 。进一步 DEBUG 发现,BouncyCastleProvider 使用了 SPI 的机制加载签名类,而 GraalVM 把 ClassLoader 给干碎了……
有没有遇到类似问题的大佬?求科普这类问题的解决方案……
2 replies • 2021-08-29 20:29:05 +08:00
 |
|
1
ccde8259 Aug 29, 2021 via iPhone
自问自答一下: 引入配置 quarkus.native.additional-build-args=-H:ReflectionConfigurationFiles=reflection-config.json 在 resources 目录下创建 reflection-config.json 文件,内容如下: [ { "name": "org.bouncycastle.jce.provider.asymmetric.ec.Signature$ecDSA256", "allDeclaredConstructors" : true, "allPublicConstructors" : true, "allDeclaredMethods" : true, "allPublicMethods" : true, "allDeclaredFields" : true, "allPublicFields" : true } ] 大意就是额外增加反射配置……
|
 |
|
2
yazinnnn Aug 29, 2021
io.quarkus.runtime.annotations.RegisterForReflection
这个注解有效不?
|