Hi!
I'm trying to access an EJBCA server via the provided web services from my java application. I am trying to run the following code snippet from the official documentation (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();
However, the first line gives me a ClassCastException: org.bouncycastle.jce.provider.BouncyCastleProvider cannot be cast to org.bouncycastle.jce.interfaces.ConfigurableProvider
. I have checked that the BouncyCastleProvider does implement the ConfigurableProvider interface.
More curiously, when i call the function twice (CryptoProviderTools.installBCProvider()
), the second time around i get a NoSuchFieldError
, with the following cause: java.lang.NoSuchFieldError: SN
Thank you very much for your help :)