Error when send message trough HTTPS (SSL)

3,147 views
Skip to first unread message

winzaldi

unread,
Dec 9, 2009, 12:16:06 AM12/9/09
to Hermes 2.0 Discussion List
Hello everyone,

i found this error when send message trough HTTPS (SSL),



09 Des 09 12:00:32
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post
SEVERE: SAAJ0009: Message send failed
Exception in thread "main"
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
java.security.PrivilegedActionException:
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send
failed
at
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call
(HttpSOAPConnection.java:146)
at com.hermes.client.clientTest.kirim(clientTest.java:85)
at com.hermes.client.clientTest.run(clientTest.java:55)
at com.hermes.client.clientTest.main(clientTest.java:51)
Caused by: java.security.PrivilegedActionException:
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send
failed
at java.security.AccessController.doPrivileged(Native Method)
at
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call
(HttpSOAPConnection.java:140)
... 3 more
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
Message send failed
at
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post
(HttpSOAPConnection.java:344)
at
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection
$PriviledgedPost.run(HttpSOAPConnection.java:169)
... 5 more
Caused by: javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException
(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal
(SSLSocketImpl.java:1591)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE
(Handshaker.java:187)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE
(Handshaker.java:181)
at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate
(ClientHandshaker.java:975)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage
(ClientHandshaker.java:123)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop
(Handshaker.java:516)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record
(Handshaker.java:454)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord
(SSLSocketImpl.java:884)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake
(SSLSocketImpl.java:1096)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake
(SSLSocketImpl.java:1123)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake
(SSLSocketImpl.java:1107)
at sun.net.www.protocol.https.HttpsClient.afterConnect
(HttpsClient.java:405)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:166)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream
(HttpURLConnection.java:832)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream
(HttpsURLConnectionImpl.java:230)
at
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post
(HttpSOAPConnection.java:301)
... 6 more
Caused by: sun.security.validator.ValidatorException: PKIX path
building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild
(PKIXValidator.java:285)
at sun.security.validator.PKIXValidator.engineValidate
(PKIXValidator.java:191)
at sun.security.validator.Validator.validate(Validator.java:
218)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate
(X509TrustManagerImpl.java:126)
at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted
(X509TrustManagerImpl.java:209)
at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted
(X509TrustManagerImpl.java:249)
at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate
(ClientHandshaker.java:954)
... 18 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
at
sun.security.provider.certpath.SunCertPathBuilder.engineBuild
(SunCertPathBuilder.java:174)
at java.security.cert.CertPathBuilder.build
(CertPathBuilder.java:238)
at sun.security.validator.PKIXValidator.doBuild
(PKIXValidator.java:280)
... 24 more

CAUSE:

java.security.PrivilegedActionException:
com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send
failed
at java.security.AccessController.doPrivileged(Native Method)
at
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.call
(HttpSOAPConnection.java:140)
at com.hermes.client.clientTest.kirim(clientTest.java:85)
at com.hermes.client.clientTest.run(clientTest.java:55)
at com.hermes.client.clientTest.main(clientTest.java:51)
Caused by: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl:
Message send failed
at
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post
(HttpSOAPConnection.java:344)
at
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection
$PriviledgedPost.run(HttpSOAPConnection.java:169)
... 5 more
Caused by: javax.net.ssl.SSLHandshakeException:
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException
(Alerts.java:174)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal
(SSLSocketImpl.java:1591)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE
(Handshaker.java:187)
at com.sun.net.ssl.internal.ssl.Handshaker.fatalSE
(Handshaker.java:181)
at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate
(ClientHandshaker.java:975)
at com.sun.net.ssl.internal.ssl.ClientHandshaker.processMessage
(ClientHandshaker.java:123)
at com.sun.net.ssl.internal.ssl.Handshaker.processLoop
(Handshaker.java:516)
at com.sun.net.ssl.internal.ssl.Handshaker.process_record
(Handshaker.java:454)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord
(SSLSocketImpl.java:884)
at
com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake
(SSLSocketImpl.java:1096)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake
(SSLSocketImpl.java:1123)
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake
(SSLSocketImpl.java:1107)
at sun.net.www.protocol.https.HttpsClient.afterConnect
(HttpsClient.java:405)
at
sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect
(AbstractDelegateHttpsURLConnection.java:166)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream
(HttpURLConnection.java:832)
at
sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream
(HttpsURLConnectionImpl.java:230)
at
com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post
(HttpSOAPConnection.java:301)
... 6 more
Caused by: sun.security.validator.ValidatorException: PKIX path
building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to
find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild
(PKIXValidator.java:285)
at sun.security.validator.PKIXValidator.engineValidate
(PKIXValidator.java:191)
at sun.security.validator.Validator.validate(Validator.java:
218)
at com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.validate
(X509TrustManagerImpl.java:126)
at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted
(X509TrustManagerImpl.java:209)
at
com.sun.net.ssl.internal.ssl.X509TrustManagerImpl.checkServerTrusted
(X509TrustManagerImpl.java:249)
at
com.sun.net.ssl.internal.ssl.ClientHandshaker.serverCertificate
(ClientHandshaker.java:954)
... 18 more
Caused by: sun.security.provider.certpath.SunCertPathBuilderException:
unable to find valid certification path to requested target
at
sun.security.provider.certpath.SunCertPathBuilder.engineBuild
(SunCertPathBuilder.java:174)
at java.security.cert.CertPathBuilder.build
(CertPathBuilder.java:238)
at sun.security.validator.PKIXValidator.doBuild
(PKIXValidator.java:280)
... 24 more
Java Result: 1

What steps should I do so I can send a message through https ??
I've changed corvus.module.xml and setting up keystore. please help
me :(


Best Regard,

aldi

Kit

unread,
Dec 10, 2009, 10:44:14 PM12/10/09
to Hermes 2.0 Discussion List
Hi Aldi,

The following example can shows u how to send a Loopback with https as
endpoint url. i think u can try this first before trying to setup a
https channel between 2 h2o instanaces.

1. Install OpenSSL for creating keys, certs and keystores. Please note
that Keytool doesn't fit our purpose in this example since it does not
support importing trusted certificates into a PKCS12 keystore.

2. Create 2 set of keystores, one for tomcat and one for h2o
%Tomcat
- tomcat.key
- tomcat.csr
- tomcat.cer
- tomcat.p12
* tomcat (key pair alias)

%H2O
- h2o.key
- h2o.csr
- h2o.cer
- h2o.p12
* h2o (key pair alias)

3. Create a tomcat truststore and import the h2o key pair into it
- tomcattruststore.p12
* h2o (key pair alias)

4. Create a tomcat truststore and import the h2o key pair into it
- h2otruststore.p12
* tomcat (key pair alias)

5. Edit the server.xml to enable the client authentication and
configure the keystore and truststore
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="true" sslProtocol="TLS"
keystoreFile="c:\tomcat.p12"
keystorePass="<keystore password>"
keystoreType="PKCS12"
truststoreFile="c:\tomcattruststore.p12"
truststorePass="<keystore password>"
truststoreType="PKCS12" />

6. Edit the h2o corvus.properties.xml instead of the
corvus.module.xml.
<environment>
<properties>
<http.proxyHost/>
<http.proxyPort/>
<https.proxyHost/>
<sun.net.client.defaultConnectTimeout>30000</
sun.net.client.defaultConnectTimeout>
<sun.net.client.defaultReadTimeout>300000</
sun.net.client.defaultReadTimeout>
<javax.net.ssl.keyStore>C:/h2o.p12</
javax.net.ssl.keyStore>
<javax.net.ssl.keyStorePassword><keystore password></
javax.net.ssl.keyStorePassword>
<javax.net.ssl.keyStoreType>PKCS12</
javax.net.ssl.keyStoreType>
<javax.net.ssl.trustStore>C:/h2otruststore.p12</
javax.net.ssl.trustStore>
<javax.net.ssl.trustStorePassword><keystore password></
javax.net.ssl.trustStorePassword>
<javax.net.ssl.trustStoreType>PKCS12</
javax.net.ssl.trustStoreType>
<file.encoding>UTF-8</file.encoding>
</properties>
</environment>

7. Restart the Tomcat.

Now u should be able to use the https as the endpoint url like
https://localhost:8443/corvus/httpd/ebms/inbound in the loopback
partnership.

* Please keep the 8080 connector in the server.xml if u want to use
the sample clients in /sample folder to send the message.

hope this help.

Regards,
Kit Yuen, Software Engineer
Apacus Software - Innovate, Simplify

Email: kit....@apacus.com
Site: http://www.apacus.com
Reply all
Reply to author
Forward
0 new messages