cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yulinxp <yuli...@gmail.com>
Subject client SSL question
Date Tue, 19 Feb 2008 20:33:45 GMT

Below is the working copy for client to connecting to a CXF server.
Because I comment out tlsParams.setKeyManagers and
tlsParams.setTrustManagers, 
client receives javax.net.ssl.SSLHandshakeException:

    HelloWorld ss = new HelloWorld();
    HelloWorldPortType port = ss.getHelloWorldPort();
    org.apache.cxf.endpoint.Client c = ClientProxy.getClient(port);

    HTTPConduit httpConduit = (HTTPConduit) c.getConduit();        
    TLSClientParameters tlsParams = new TLSClientParameters();
    tlsParams.setSecureSocketProtocol("SSL");
//    try {
//        tlsParams.setKeyManagers(xxxx);
//        tlsParams.setTrustManagers(xxx);
//    } catch (IOException e) {
//        e.printStackTrace();
//    }       
    httpConduit.setTlsClientParameters(tlsParams);

Caused by: javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: No trusted certificate found
	at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:150)
	at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1476)
	at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:174)
	at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE(Handshaker.java:168)
	at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:847)
	at
com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:106)
	at com.sun.net.ssl.internal.ssl.Handshaker.processLoop(Handshaker.java:495)
	at
com.sun.net.ssl.internal.ssl.Handshaker.process_record(Handshaker.java:433)
	at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:815)
	at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1025)
	at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1038)
	at
sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:402)
	at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:170)
	at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:836)
	at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1766)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1734)
	at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42)
	at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:96)
	at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214)
	at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
	... 100 more
Caused by: sun.security.validator.ValidatorException: No trusted certificate
found
	at
sun.security.validator.SimpleValidator.buildTrustedChain(SimpleValidator.java:304)
	at
sun.security.validator.SimpleValidator.engineValidate(SimpleValidator.java:107)
	at sun.security.validator.Validator.validate(Validator.java:203)
	at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:172)
	at
com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSLContextImpl.java:320)
	at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:840)

Now I use the same client to connect to NET server, I got different
exception. 
Why it's using java.net.PlainSocketImpl to make the connection? 
I don't understand why the same client has different path when connecting to
different severs?

Caused by: com.ctc.wstx.exc.WstxIOException: wjcp7meduat1.medpoint.com
	at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
	at
org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:73)
	... 8 more
Caused by: java.net.UnknownHostException: wjcp7meduat1.medpoint.com
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
	at java.net.Socket.connect(Socket.java:507)
	at sun.net.NetworkClient.doConnect(NetworkClient.java:152)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:365)
	at sun.net.www.http.HttpClient.openServer(HttpClient.java:477)
	at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:278)
	at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:335)
	at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:176)
	at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:744)
	at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:162)
	at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:836)
	at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1766)
	at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1734)
	at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42)
	at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:96)
	at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214)
	at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
-- 
View this message in context: http://www.nabble.com/client-SSL-question-tp15564062p15564062.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message