如何解决Mqtt Exaception:无法找到请求的目标的有效认证路径
我尝试做类似的事情:
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复制到树莓派并在java.security
文件中注释此行
#jdk.security.cadistrustPolicies=SYMANTEC_TLS
它也可以。
我的问题:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。