你好!
我正在尝试通过我的 java 应用程序中提供的 Web 服务访问 EJBCA 服务器。我正在尝试从官方文档(http://ejbca.org/docs/adminguide.html#Using%20the%20Web%20Service%20API%20for%20Integration)运行以下代码片段:
CryptoProviderTools.installBCProvider();
String urlstr = "https://localhost:8443/ejbca/ejbcaws/ejbcaws?wsdl";
System.setProperty("javax.net.ssl.trustStore","p12/wstest.jks");
System.setProperty("javax.net.ssl.trustStorePassword","foo123");
System.setProperty("javax.net.ssl.keyStore","p12/wstest.jks");
System.setProperty("javax.net.ssl.keyStorePassword","foo123");
QName qname = new QName("http://ws.protocol.core.ejbca.org/", "EjbcaWSService");
EjbcaWSService service = new EjbcaWSService(new URL(urlstr),qname);
ejbcaraws = service.getEjbcaWSPort();
但是,第一行给了我一个 ClassCastException: org.bouncycastle.jce.provider.BouncyCastleProvider cannot be cast to org.bouncycastle.jce.interfaces.ConfigurableProvider
。我检查了 BouncyCastleProvider 确实实现了 ConfigurableProvider 接口。
更奇怪的是,当我调用该函数两次 ( CryptoProviderTools.installBCProvider()
) 时,第二次我得到 a NoSuchFieldError
,原因如下:java.lang.NoSuchFieldError: SN
非常感谢您的帮助 :)