I call the below "initSSL()"  method, before invoking webservice, still
I get the below exception.

does CXF uses other than built-in HttpsURLConnection?

How to ignore the trustStore? 

Note : I am just writing a POC using CXF aginst old webservice - where
service is not under my control.

Mohan


        private static void initSSL() {
                System.setProperty("javax.net.debug ", "true");
                try {
                        TrustManager[] trustAllCerts = new
TrustManager[] { new FakeTrustManager() };
                        SSLContext sc = SSLContext.getInstance("SSL");
                        sc.init(null, trustAllCerts, new
java.security.SecureRandom());
        
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());

                } catch (KeyManagementException e) {
                        e.printStackTrace();
                } catch (NoSuchAlgorithmException e) {
                        e.printStackTrace();
                }
        }



org.apache.cxf.interceptor.Fault: Could not send Message.
        at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
nterceptor.handleMessage(MessageSenderInterceptor.java:64)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorC
hain.java:220)
        at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466)
        at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
        at
org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
        at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
        at $Proxy40.resetContactPassword(Unknown Source)
        at my.client.MyClient.invokeService(MyClient.java:91)
        at my.client.MyClient.main(MyClient.java:67)
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:1518
)
        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(ClientHa
ndshaker.java:848)
        at
com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage(ClientHands
haker.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:4
33)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java
:818)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSo
cketImpl.java:1030)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.
java:1057)
        at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.
java:1041)
        at
sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:402
)
        at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Ab
stractDelegateHttpsURLConnection.java:170)
        at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConne
ction.java:861)
        at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsU
RLConnectionImpl.java:230)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHead
ersTrustCaching(HTTPConduit.java:1836)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWri
te(HTTPConduit.java:1794)
        at
org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutpu
tStream.java:42)
        at
org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdO
utputStream.java:69)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTP
Conduit.java:1854)
        at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
        at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:595)
        at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingI
nterceptor.handleMessage(MessageSenderInterceptor.java:62)
        ... 9 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.ja
va:107)
        at sun.security.validator.Validator.validate(Validator.java:203)
        at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted(X50
9TrustManagerImpl.java:172)
        at
com.sun.net.ssl.internal.ssl.JsseX509TrustManager.checkServerTrusted(SSL
ContextImpl.java:320)
        at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate(ClientHa
ndshaker.java:841)
        ... 28 more


==============================================================================
Please access the attached hyperlink for an important electronic communications 
disclaimer: 

http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
==============================================================================

Reply via email to