Edit :- Tried to format the question and accepted answer in more presentable way at mine Blog
Here is the original issue.
In my case the issue was that the webserver was only sending the certificate and the intermediate CA, not the root CA.
Adding this JVM option solved the problem: -Dcom.sun.security.enableAIAcaIssuers=true
Support for the caIssuers access method of the Authority Information Access extension is available. It is disabled by default for compatibility and can be enabled by setting the system property
com.sun.security.enableAIAcaIssuers
to the value true.If set to true, Sun's PKIX implementation of CertPathBuilder uses the information in a certificate's AIA extension (in addition to CertStores that are specified) to find the issuing CA certificate, provided it is a URI of type ldap, http, or ftp.
Source