Hi,
I have exposed a web service on SSL enabled Tomcat server , I generated
client code with WSDL2JAVA , When i call the service i greeting above
exception , my client code and error trace are listed below .
later i tried with adding
System.setProperty("javax.net.ssl.trustStoreType", "JKS");  but again end up
with same exception ,



public static void main(String[] args) throws Exception {

        String EPurl = "https://127.0.0.1:8443/axis2/services/SecureService
";
        String repoPath = "client-repo";

        System.setProperty("javax.net.ssl.trustStore", repoPath +
"server.jks");
        System.setProperty("javax.net.ssl.trustStorePassword", "password");

        ConfigurationContext ctx = ConfigurationContextFactory
                .createConfigurationContextFromFileSystem(repoPath, null);

        ctx.setProperty("javax.net.ssl.trustStore", repoPath +
"server.jks");
        ctx.setProperty("javax.net.ssl.trustStorePassword", "password");
        SecureServiceStub stub = new SecureServiceStub(ctx, EPurl);
        Add add = new Add();
        add.setA(3);
        add.setB(5);
        ServiceClient sc = stub._getServiceClient();
        sc.engageModule("rampart");
        Options op = sc.getOptions();
        op.setUserName("user");
        op.setPassword("password");
        AddResponse res = stub.add(add);
        int result = res.get_return();
        System.out.println(" resault = " + result);

    }






Exception in thread "main" org.apache.axis2.AxisFault:
java.lang.RuntimeException: Unexpected error:
java.security.InvalidAlgorithmParameterException: the trustAnchors parameter
must be non-empty
    at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
    at
org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:83)
    at
org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
    at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
    at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
    at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
    at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
    at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
    at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:542)
    at
org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:189)
    at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:364)
    at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:208)
    at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
    at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:401)
    at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
    at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
    at
tutorial.rampart.service.SecureServiceStub.add(SecureServiceStub.java:186)
    at my.Client.main(Client.java:50)
Caused by: com.ctc.wstx.exc.WstxIOException: java.lang.RuntimeException:
Unexpected error: java.security.InvalidAlgorithmParameterException: the
trustAnchors parameter must be non-empty
    at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
    at
org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:146)
    at
org.apache.axiom.om.impl.dom.NodeImpl.serializeAndConsume(NodeImpl.java:817)
    at
org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79)
    ... 19 more
Caused by: javax.net.ssl.SSLException: java.lang.RuntimeException:
Unexpected error: java.security.InvalidAlgorithmParameterException: the
trustAnchors parameter must be non-empty
    at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(Unknown
Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(Unknown
Source)
    at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
    at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
    at java.io.BufferedOutputStream.flush(Unknown Source)
    at java.io.FilterOutputStream.flush(Unknown Source)
    at
org.apache.commons.httpclient.ChunkedOutputStream.flush(ChunkedOutputStream.java:191)
    at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:99)
    at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214)
    at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
    ... 22 more
Caused by: java.lang.RuntimeException: Unexpected error:
java.security.InvalidAlgorithmParameterException: the trustAnchors parameter
must be non-empty
    at sun.security.validator.PKIXValidator.<init>(Unknown Source)
    at sun.security.validator.Validator.getInstance(Unknown Source)
    at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.getValidator(Unknown
Source)
    at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown
Source)
    at
com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(Unknown
Source)
    at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(Unknown
Source)
    at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(Unknown
Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Unknown Source)
    at com.sun.net.ssl.internal.ssl.Handshaker.process_record(Unknown
Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source)
    at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Unknown
Source)
    at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown
Source)
    ... 30 more
Caused by: java.security.InvalidAlgorithmParameterException: the
trustAnchors parameter must be non-empty
    at java.security.cert.PKIXParameters.setTrustAnchors(Unknown Source)
    at java.security.cert.PKIXParameters.<init>(Unknown Source)
    at java.security.cert.PKIXBuilderParameters.<init>(Unknown Source)
    ... 42 more






Thanks ,

-- 
Sagara Gunathunga

Blog - ssagara.blogspot.com
Web - http://sagaras.awardspace.com/

Reply via email to