gpt4 book ai didi

java - Google 和 FB 身份验证服务 - java.lang.NoClassDefFoundError : org/bouncycaSTLe/jcajce/provider/asymmetric/rsa/BCRSAPublicKey

转载 作者:行者123 更新时间:2023-12-01 09:47:53 25 4
gpt4 key购买 nike

我已向 pom.xml 添加了新的 Bouncy CaSTLe 依赖项

<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.54</version>
</dependency>

当我尝试使用 Google Sign 服务时,我遇到了下面提到的异常:

INFO: Illegal access: this web application instance has been stopped already. Could not load org.bouncycastle.jcajce.provider.asymmetric.x509.CertificateFactory. The eventual following stack trace is caused by an error thrown for debug
ging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.

java.lang.IllegalStateException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1610)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1569)
at java.security.Provider$Service.getImplClass(Provider.java:1281)
at java.security.Provider$Service.newInstance(Provider.java:1237)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at java.security.cert.CertificateFactory.getInstance(CertificateFactory.java:183)
at com.google.api.client.util.SecurityUtils.getX509CertificateFactory(SecurityUtils.java:217)
at com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager.refresh(GooglePublicKeysManager.java:171)
at com.google.api.client.googleapis.auth.oauth2.GooglePublicKeysManager.getPublicKeys(GooglePublicKeysManager.java:141)
at com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier.verify(GoogleIdTokenVerifier.java:173)
at com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier.verify(GoogleIdTokenVerifier.java:191)

java.lang.NoClassDefFoundError: org/bouncycastle/jcajce/provider/asymmetric/rsa/BCRSAPublicKey
at org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi.generatePublic(Unknown Source)
at org.bouncycastle.jcajce.provider.asymmetric.util.BaseKeyFactorySpi.engineGeneratePublic(Unknown Source)
at org.bouncycastle.jcajce.provider.asymmetric.rsa.KeyFactorySpi.engineGeneratePublic(Unknown Source)
at java.security.KeyFactory.generatePublic(KeyFactory.java:334)
at sun.security.x509.X509Key.buildX509Key(X509Key.java:223)
at sun.security.x509.X509Key.parse(X509Key.java:170)

直接使用 Bouncy CaSTLe 库的其他代码片段可以很好地工作。我仅在尝试验证 token 的 Google 和 FB 登录服务中遇到过此问题。如何让他们协同工作?

最佳答案

正在寻找 grepcode 上的类(class),看来类(class)处于不同的 Bouncycastle jar :

<!-- http://mvnrepository.com/artifact/org.bouncycastle/bcprov-ext-jdk15on -->
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-ext-jdk15on</artifactId>
<version>1.54</version>
</dependency>

尝试将该依赖项添加到您的项目中。

关于java - Google 和 FB 身份验证服务 - java.lang.NoClassDefFoundError : org/bouncycaSTLe/jcajce/provider/asymmetric/rsa/BCRSAPublicKey,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37834178/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com