首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >连接mongodb时的Spring Native问题

连接mongodb时的Spring Native问题
EN

Stack Overflow用户
提问于 2021-04-17 20:02:02
回答 1查看 141关注 0票数 0

我的spring应用程序使用mongodb实现持久性。应用程序使用用户名/密码连接到mongodb。

为了发现Spring Native的好处,我在我的Ubuntu18LTS上创建了一个docker镜像。当我使用docker compose运行应用程序镜像和mongodb镜像时,一切看起来都很好。当我调用插入mongodb的rest api时,应用程序抛出错误

代码语言:javascript
复制
com.oracle.svm.core.jdk.UnsupportedFeatureError: Trying to verify a provider that was not registered at build time: SunJCE version 11. 
All providers must be registered and verified in the Native Image builder. 
Only the SUN provider is registered and verified by default. 
All other built-in providers are processed when all security services are enabled 
using the --enable-all-security-services option. 
Third party providers must be configured in the Native Image builder VM. 
at com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:87)
native-demo |   at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:384)
native-demo |   at javax.crypto.JceSecurity.canUseProvider(JceSecurity.java:231)
native-demo |   at javax.crypto.Mac.getInstance(Mac.java:186)
native-demo |   at com.mongodb.internal.connection.ScramShaAuthenticator$ScramShaSaslClient.hi(ScramShaAuthenticator.java:299)

操作系统: Ubuntu 18 LTS

Spring Native: 0.9.0

Spring Boot: 2.4.3

JDK:‘OpenJDK版本"11.0.7“2020-04-14 OpenJDK运行时环境GraalVM CE 20.1.0 (内部版本11.0.7+10-jvmci-20.1-b02) OpenJDK 64位服务器VM GraalVM CE 20.1.0 (内部版本11.0.7+10-jvmci-20.1-b02,混合模式,共享’

参考https://www.graalvm.org/reference-manual/native-image/BuildConfiguration/#configuration-file-format,我还创建了一个具有以下内容NativeImageArgs = --enable-all-security-services的文件META-INF/native-image.properties

即使在重建映像之后,该问题仍然存在。

如何解决此问题?任何可能的解决方案的建议。

EN

回答 1

Stack Overflow用户

发布于 2021-04-23 11:27:41

你能在你的spring-boot-maven-plugin中添加一个构建参数吗?

代码语言:javascript
复制
                <configuration>
                    <image>
                        <builder>paketobuildpacks/builder:tiny</builder>
                        <env>
                            <BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
                            <BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
                                - H:IncludeResourceBundles=sun.security.util.Resources
                            </BP_NATIVE_IMAGE_BUILD_ARGUMENTS>
                        </env>
                    </image>
                </configuration>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67137936

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档