Recently I was working on integration with PayPal and I wanted to use certificate based authorization of webservices calls. It was working fine in my integration test (which can be run as standalone Java application), but it was not working when run from real application deployed to Tomcat.
I was getting this exception:
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure at sun.security.ssl.Alerts.getSSLException(Alerts.java:192) at sun.security.ssl.Alerts.getSSLException(Alerts.java:154) at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1943) at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1059) at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1294) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1321) at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1305) at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:523) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1087) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleHeadersTrustCaching(HTTPConduit.java:1355) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.onFirstWrite(HTTPConduit.java:1301) at org.apache.cxf.io.AbstractWrappedOutputStream.write(AbstractWrappedOutputStream.java:42) at org.apache.cxf.io.AbstractThresholdOutputStream.write(AbstractThresholdOutputStream.java:69) at org.apache.cxf.io.CacheAndWriteOutputStream.write(CacheAndWriteOutputStream.java:68) at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:100) at com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:225) at com.ctc.wstx.sw.BufferingXmlWriter.close(BufferingXmlWriter.java:198) at com.ctc.wstx.sw.BaseStreamWriter._finishDocument(BaseStreamWriter.java:1400) ... 135 more
So I added debug JVM option to Tomcat startup:
-Djavax.net.debug=ssl
And then I’ve found following message in logs:
http-80-Processor5, READ: SSLv3 Handshake, length = 4 *** ServerHelloDone [read] MD5 and SHA1 hashes: len = 4 0000: 0E 00 00 00 .... http-80-Processor5, SEND SSLv3 ALERT: warning, description = no_certificate http-80-Processor5, WRITE: SSLv3 Alert, length = 2 [Raw write]: length = 7 0000: 15 03 00 00 02 01 29
As we can see here application could not find certificate in keystore. After searching the web for solution I couldn’t find anything helpful. But then I also found out that when Tomcat is starting it is using trustStore from JVM (in my case located in C:\Program Files\Java\jrockit-jdk1.6.0_37-R28.2.5-4.1.0\jre\lib\security\cacerts).
So in my case solution for this problem was simple. I had problem with properties overrides and my keystore was not loaded correctly. In this case default trustStore was taken into consideration and it didn’t have requested certificate. After fixing configuration exception was gone.
Pingback: Ivon Gregory
Pingback: creditmattersinc.org
Pingback: Rolf Prentiss
Pingback: viagra black
Pingback: cialis otc
Pingback: cialis coupon
Pingback: is there a generic cialis
Pingback: cheap viagra
Pingback: cheap erectile dysfunction pills online
Pingback: new ed pills
Pingback: pills for ed
Pingback: cialis 10 mg
Pingback: canadian online pharmacy
Pingback: cvs pharmacy
Pingback: generic cialis online
Pingback: cialis online
Pingback: levitra online
Pingback: generic levitra online
Pingback: order vardenafil
Pingback: best online casino real money
Pingback: slot games
Pingback: herbal viagra
Pingback: online casinos
Pingback: slots online
Pingback: loans for bad credit
Pingback: loan online
Pingback: online loans
Pingback: viagra 100mg
Pingback: best online casino usa
Pingback: casino online slots
Pingback: bingo deposit online uk
Pingback: best casino online for us players
Pingback: CafeCasino
Pingback: cialis 5 mg
Pingback: generic cialis
Pingback: 20 cialis
Pingback: cialis 5 mg
Pingback: slot machine
Pingback: free slots online
Pingback: viagra online canada
Pingback: viagra online usa
Pingback: sildenafil vs tadalafil
Pingback: cost of viagra 100mg walmart
Pingback: sildenafil 100mg price
Pingback: cheap viagra
Pingback: viagra
Pingback: cheap viagra
Pingback: order sildenafil
Pingback: cialis generic tadalafil
Pingback: sildenafil
Pingback: buy generic drugs without prescription
Pingback: prescription drugs without doctor approval
Pingback: shop pharmacie
Pingback: buy cialis online without prescription
Pingback: cheap cialis
Pingback: generic pills
Pingback: buy cheap viagra
Pingback: buy cialis
Pingback: buy viagra
Pingback: online drug store
Pingback: buy viagra online
Pingback: cheap ed pills
Pingback: cialis
Pingback: treat ed
Pingback: ed meds online without doctor prescription
Pingback: generic viagra online reviews
Pingback: generic for amoxicillin
Pingback: sildenafil 120
Pingback: sildenafil 25 mg online
Pingback: payday loans
Pingback: viagra soft tabs 100mg
Pingback: how to viagra prescription
Pingback: order viagra for women
Pingback: Usa viagra sales
Pingback: sildenafil pharmacy
Pingback: where can you buy over the counter viagra
Pingback: Brand viagra professional
Pingback: Drug viagra
Pingback: community service essay
Pingback: cialis
Pingback: customessaywriterbyz.com
Pingback: buy dissertation online
Pingback: expository essay help
Pingback: best admission essay editing service
Pingback: viagra
Pingback: thesis writing assistance
Pingback: research paper outline help
Pingback: where can i find someone to write my college paper
Pingback: what is thesis in writing
Pingback: Viagra 100mg england
Pingback: cheap viagra
Pingback: generic drugs
Pingback: Zithromax online
Pingback: best natural cure for ed
Pingback: cialis generic
Pingback: cheap cialis
Pingback: cialis without a doctor prescription
Pingback: viagra over the counter walmart
Pingback: natural viagra for men
Pingback: how to use viagra for best results
Pingback: viagra ingredients
Pingback: how long does viagra take to work
Pingback: how to buy cialis from canada
Pingback: zithromax buy online
Pingback: buy generic viagra
Pingback: buy viagra online
Pingback: over the counter erectile dysfunction pills
Pingback: canada prescriptions drugs
Pingback: canadian pharmacies
Pingback: generic Aciclovir
Pingback: Zerit
Pingback: canadian pharmacy online viagra
Pingback: drug stores near me
Pingback: canadian online pharmacies
Pingback: approved canadian online pharmacies
Pingback: cheap generic viagra
Pingback: generic viagra online
Pingback: order bactrim
Pingback: amoxicillin 500mg capsule
Pingback: buy allegra australia
Pingback: zyrtec 10.00 coupon
Pingback: when will viagra be generic
Pingback: viagra online
Pingback: buy zithromax without prescription online
Pingback: can we buy amoxcillin 500mg on ebay without prescription
Pingback: buy generic drugs without prescription
Pingback: viagra
Pingback: walmart cialis pharmacy
Pingback: tadalafil
Pingback: cialis professional vs cialis super active
Pingback: tadalafil 20 mg
Pingback: best generic cialis
Pingback: prescription viagra online without doctor
Pingback: cialis black 800 mg pill house
Pingback: viagra interac online
Pingback: price of sildenafil in india
Pingback: best prices for generic cialis
Pingback: buy sildenafil
Pingback: generic tadalafil
Pingback: best otc ed pills
Pingback: best male enhancement pills
Pingback: bfwwgzxi
Pingback: top ed pills
Pingback: kamagra oral jelly how long does it last
Pingback: waarom is viagra verboden
Pingback: online viagra
Pingback: which is stronger augmentin or zithromax
Pingback: lasix generic
Pingback: chloramphenicol price
Pingback: zyvox online
Pingback: buy ciplox generic
Pingback: cialis
Pingback: is there a generic viagra
Pingback: buy bactrim
Pingback: legitimate cialis by mail
Pingback: viagra
Pingback: cost of cialis
Pingback: best uk essay writing service
Pingback: writing an introduction for a research paper
Pingback: help writing my essay
Pingback: help essay
Pingback: themes of professionalism and business ethics essay