我的堆栈跟踪中有以下错误消息:
Caused by: java.lang.ClassCastException: org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey cannot be cast to org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey
at myorg.blockchain.axr.util.FabricCA.loadSDKUser(FabricCA.java:90)
at myorg.blockchain.axr.core.Platform.init(Platform.java:91)
... 115 more
该行引用了以下代码段的最后一行:
String keyPass = decryptPassword(appUserKeyPassword, appUserName, appUserAffiliation, appUserMspId);
// read and parse the encrypted private key PEM
pemParser = new PEMParser(new InputStreamReader(ResourceLoader.getResourceAsStream(appUserKeyPath)));
PKCS8EncryptedPrivateKeyInfo encPrivKeyInfo = (PKCS8EncryptedPrivateKeyInfo) pemParser.readObject();
JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider(BouncyCastleProvider.PROVIDER_NAME);
InputDecryptorProvider pkcs8Prov = new JceOpenSSLPKCS8DecryptorProviderBuilder().build(keyPass.toCharArray());
BCECPrivateKey privKey = (BCECPrivateKey)converter.getPrivateKey(encPrivKeyInfo.decryptPrivateKeyInfo(pkcs8Prov));
我查找了这个异常,所有这些异常都涉及某种类装入器问题。这个问题和其他类装入器问题类似吗?我应该如何调试这个?
编辑:这段代码是独立开发的,但是当集成到父应用程序中时,它将在tomcat中运行。不确定这是否解决了“在容器中运行”的问题?
暂无答案!
目前还没有任何答案,快来回答吧!