Java Mqtt ExaException:找不到请求目标的有效证书路径
我试着做一些事情,比如:Java Mqtt ExaException:找不到请求目标的有效证书路径,java,amazon-web-services,certificate,mqtt,symantec,Java,Amazon Web Services,Certificate,Mqtt,Symantec,我试着做一些事情,比如: public static void main(String[] args) throws FileNotFoundException, IOException { try (InputStream keyStoreStream = new FileInputStream(Configuration.KEYSTOREPATH_CLAIM.toAbsolutePath().toFile())) { String keysto
public static void main(String[] args) throws FileNotFoundException, IOException {
try (InputStream keyStoreStream = new FileInputStream(Configuration.KEYSTOREPATH_CLAIM.toAbsolutePath().toFile())) {
String keystoreClaimPass = new String(Files.readAllBytes(Configuration.KEYSTOREPATH_CLAIM_PASS));
KeyStore keyStoreClaim = KeyStore.getInstance(Configuration.KEYSTORE_TYPE);
keyStoreClaim.load(keyStoreStream, keystoreClaimPass.toCharArray());
System.out.println("KeyStore with claim certificate is loaded successfully");
AWSIotMqttClient iotClient = new AWSIotMqttClient(Configuration.IOT_CLIENT_ENDPOINT,
"not_existing_id",
keyStoreClaim,
keystoreClaimPass);
iotClient.connect();
System.out.println("Temporary IoT client is loaded successfully");
} catch (NoSuchAlgorithmException | CertificateException | KeyStoreException e) {
throw new IOException("Creation temporary keystore by claim for IoT client is failed", e);
} catch (AWSIotException e) {
throw new IOException("Connection to IoT through claim certificate is failed", e);
}
}
它在windows(jdk-1.8.0)中工作,在Raspberry Buster(openjdk-8)中不工作
所以,如果我将cacerts
文件从windows复制到raspberry,并在java.security
文件中注释这一行
#jdk.security.caDistrustPolicies=SYMANTEC_TLS
它也起作用
我的问题是: