It shows that the server authentication in TrustManager in SSL connection configuration failed, that is, the host used when signing the server certificate is different from the one signed now. If it is HTTPS, you can solve the problem by rewriting hostNameVerifyer. There are many strategies on the Internet.
When you encounter this problem in Mqtt connection, you should check whether there is any conflict between versions that rely on pom.xml. After actual verification, the version of paho will encounter this problem when using the newer version (no matter whether the certificate is right or wrong, the name matching error will not be reported first, presumably the verification mechanism of the lower version is weak), so we can refer to the following collocation and use the lower version to skip this error. Because there is no way to ignore host authentication when mqtt ssl connection is found.
When you encounter this problem in Mqtt connection, you should check whether the certificate you are using now is different from the certificate on the server side. This time I'm stuck on this problem.
Dependencies in the pom.xml file: