Fix for Cannot recover key error in JAVA

This is how i fixed Cannot recover key error in JAVA while i was setting up an SSL configuration for one of the Application Servers. Following is the part of the exception that i noted in the error log of my app,I couldn't start my tomcat and  jboss servers because of the below error.

ERROR - Could not start server:java.security.UnrecoverableKeyException: Cannot recover key
java.io.IOException: !JsseListener: java.security.UnrecoverableKeyException: Cannot recover key
    at org.mortbay.jetty.security.SslSocketConnector.newServerSocket(SslSocketConnector.java:516)
    at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
    at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:283)
    at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:147)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)

I see there are lot of post in google, but hard to find the exact solution, here it goes.

What causes this SSL error?
 
The answer is simple, the passwords of the Certificate Key and the generated keystore are different, they cannot be different and they should be same.If your certificate cer/crt/pfx key has a password called hpanswers then your generated keystore file should also have a similar password called hpanswers, it cannot be different, so both the certificate key and the jks keystore file should have the same password.

You either need to regenerate the keystore with the same password as certificate key or change the password for both..Set the key password to be the same as keystore password, using the below java keytool command

The below is an example , here the certificate key password is oldpass and the key password is hpanswers, we are now changing they certificate key password to hpanswers

$ keytool -keypasswd -keystore test.jks -alias ssltest
Enter keystore password:  hpanswers
Enter key password for ssltesr: oldpass
New key password for ssltest:  hpanswers
Re-enter new key password for :  hpanswers

Following is some useful information i noted while i was solving this posted on globalsign

How to Fix "Cannot Recover Key" Error

The error “java.security.UnrecoverableKeyException: Cannot recover key” occurs when the keystore and keyEntry passwords are different. To resolve this issue, you must remove all traces of the past certificate and request the file.

You must generate a new keystore, keyEntry and CSR. You must also specify the same password for the keystore and the keyEntry.

Useful References to understand this issue better.
  1. java.io.IOException: Cannot recover key
  2.  Cannot recover key tomcat
  3. Fish Eye Server Error

Review and Blissful Experience With Banggood

This is my first review and an experience with Banggood.com, I came across Banggood.com site when my interest drifted towards buying a stable helicopter, I was going through RC forums and someone suggested to buy the Genuine S107G Heli from BangGood.Finally, I did buy my First RC Syma S107G and some spares of Syma S107G from Banggood, my shopping was fruitful and hassle free.



Here is how it went through, Banggood.com

Order and Payment

When i first visited Banggood.com, I was in a state either to trust or not, as this is not a big platform as Alibaba,Ali express,Amazon, Ebay and no Buyer Protection system in place.In-addition,this will be a international shopping i will be doing, i need to go through all hassles like customs, shipping,the product reliability and genuineness. Looking at the forums, reviews and the user experiences and the support system of banggood forums, I finally decided to give it a try.


I placed my First order at banggood.com to buy a Genuine Syma S107G. Yes, they sell Genuine and Original Syma S107G for a lot less price than any others on the Net World!.(There are lot of fakes and clones of Syma s107G, i do not want to fall into this pit). Added the S107G to cart and used my Credit Card Via Paypal as a Payment option (In view of Paypal Buyer Protection System in place), there are multiple payment options available, check here for more details on Banggood Shipping

The Order process was smooth, As soon as the payment is confirmed, I received an e-mail confirming my Order with Order Details which includes Order number, shipping method and product details.Below is the Order Process steps at banggood.


Shipping:

It was shipped on Next Working Day(Monday), as I placed the Order on End of Friday.A Day later it was shipped, i got the tracking number of the shipment which i was able to track at 17track.net.

And it was a Good Journey, I had to wait 14 Days(Including Weekends) to get my Shipment,from the day of order to delivery By EMS and it took 7 Days from the date when the Shipment started traceable.Keeping my International shopping experience in mind, I waited patiently to get My S107G, Customs wasn't a Hassle, it got cleared the same day as it is a R/C Heli and not a Radio one with more than 2.4GHZ Frequency,

Out of Box, Banggood customized Packing, the products were really Genuine and as advertised on their site, nothing missing in the shipment, it was blissful experience

Note: Out of good amount of  experience on international shopping, its not "Time is of the Essence" its "Patience is of the Essence" If you want something for less , you have to wait, if you can't, you have to pay more and that's -Shipping. its  See-Saw.

To summarize, What i liked
  •  Low Prices, Great Deals,Wide Variety of Products
  •  Great RC Toys, (Specially Quadcopters, Helicopters)
  •  Good Customer Support - Chat , E-mail and Phone Options (http://www.banggood.com/help_center)
  •  Dedicated Forum Employees, Replies your Delivery and Order issues Promptly
  • Great Refund System- Awesome-->Genuine cases, they refund in 48 Hours
  • Promotional Offers (Thanks Giving , Christmas..Offers)
  • Multiple Shipping Methods , Very Low Shipping Prices when compared to Aliexpress, Alibaba and other international sites
  • Multiple Payment Options
  • Coupons , Affiliate Programs, Winning Free Stuff
  • Dynamic updates to the Products and Frequent Seasonal and Festive Offers
And what i do not!
  •  Standard Shipping Option Should come with Tracking Number (currently its untracked)
  • Standard and Air Parcel Register through China Post - Which is very slow, better if they switch to Hongkong Post.
As of now, I will Stick to these and keep this post updated on my Growing Shopping Experience with Banggood.Wishing You a Wonderful Shopping Experience at Banggood.com .

My One Word to International Shoppers, Be Patient while doing  a global shopping, order and forget, it will arrive one day - for sure.Banggood seems to be Legitimate, danviews review inspired me to give a try.Hope my experience inspires you to shop at Banggood.com

Post your Comments and your review on Banggood.com using the below comments section.

Thanks
HP Answers