sun.security.validator.ValidatorException: TLS Server certificate issued after 2019-04-16问题

问题

订阅aws-iot的mqtt服务器的时候,出现了如下错误:

Caused by: sun.security.validator.ValidatorException: TLS Server certificate issued after 2019-04-16 and anchored by a distrusted legacy Symantec root CA: CN=…

解决

让java忽略https证书校验:

@SpringBootApplication
public class Mqtt2KafkaApplication {

	public static void main(String[] args) {
		// 忽略https证书校验
		java.security.Security.setProperty("jdk.security.caDistrustPolicies", "");
		SpringApplication.run(Mqtt2KafkaApplication.class, args);
	}

}

总结

强行让Spring忽略https证书校验。

你可能感兴趣的:(https,java,tls)