An error occurred for sslhandshakeexception-unable to find valid certification path to requested target
Locate the corresponding Jssecacerts file or cacerts on the server, typically in the <jre home>/lib/security directory, execute the following code locally, add cert to the file,
Replace the old file with the newly generated jssecacerts (recommended to back up first)
Package com.rockbb.test;/* * Copyright 2006 Sun Microsystems, Inc. All rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, is permitted provided that the FOL lowing conditions * is met: * *-redistributions of source code must retain the above copyright * notice, this LIS T of conditions and the following disclaimer. * *-redistributions in binary form must reproduce the above copyright * Notice, this list of conditions and the FO Llowing Disclaimer in the * documentation and/or other materials provided with the distribution. * *-Neither the name of Sun Microsystems nor the names of its * contributors is used to endorse or promote pro Ducts derived * from this software without specific prior written permission. * * This software are provided by the COPYRIGHT holders and CONTRIBUTORS ' as * is ' and any EXPRESS OR implied warranties, I Ncluding, but not LIMITED to, * The implied warranties of merchantabilitY and FITNESS for A particular * PURPOSE is disclaimed. In NO EVENT shall the COPYRIGHT OWNER OR * CONTRIBUTORS is liable for any DIRECT, INDIRECT, incidental, special, * EXEMPLA RY, or consequential damages (including, but not LIMITED to, * procurement of substitute GOODS OR SERVICES; LOSS of Use, DATA, OR * profits; or business interruption) however caused and on any theory of * liability, WHETHER in contract, STRICT liability, OR TORT (including * negligence OR OTHERWISE) Arising in an any-out-of-the-software, even IF advised of the possibility of SUCH DAMAGE. */import java.io.*;import java.net.url;import java.security.*;import java.security.cert.*;import javax.net.ssl.*; public class Installcert{public static void Main (string[] args) throws Exception{args = new string[]{"Api.weixin.qq.com"} ; String Host;int port;char[] passphrase;if ((args.length = = 1) | | (Args.length = = 2)) {string[] c = Args[0].split (":"); host = c[0];p ort = (C.length = = 1)? 443:integer.parseint (c[1]); String p = (Args.length = = 1)? "Changeit": args[1];p assphrase = P.tochararray ();} Else{system.out.println ("Usage:java installcert Java Add SSL certificate manually