i am trying to download from these url
"https://www.treasury.gov/ofac/downloads/sdn.xml" but it is saying that
"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"
I have tried below two,but it's not working
1. System.setProperty("com.sun.security.enableAIAcaIssuers","true");
2. updated my java version from 1.7 to 1.8.0_121
download("https://www.treasury.gov/ofac/downloads/sdn.xml","D:\\AML_Files\\Download_Check\\sdnList.xml");
public static void download(String url, String fileName) throws Exception {
//System.setProperty("com.sun.security.enableAIAcaIssuers","true");
try (InputStream in = URI.create(url).toURL().openStream()) {
Files.copy(in, Paths.get(fileName));
}
}
i want to download xml file in my system and after that insert that xml file data to database table