出现javax.net.ssl.SSLProtocolException: handshake alert: unrecognized_name

今天研究网上的java版的微信模拟登录群发消息的代码时,运行报错handshake alert:unrecognized_name,调试发现完整的错误为javax.net.ssl.SSLProtocolExceptionhandshake alert:unrecognized_name 在百度上发现有网友说是因为JDK的版本不对导致,笔者更换了jdk的版本发现问题依旧,最后看到另一个网友的解决方案

设置系统属性:System.setProperty ("jsse.enableSNIExtension", "false");

如果是tomcat,则catalina.sh增加:-Djsse.enableSNIExtension=false



jsse.enableSNIExtension system property. Server Name Indication (SNI) is a TLS extension, defined in RFC 4366. It enables TLS connections to virtual servers, in which multiple servers for different network names are hosted at a single underlying network address.

Some very old SSL/TLS vendors may not be able handle SSL/TLS extensions. In this case, set this property to false to disable the SNI extension.

你可能感兴趣的:(架构设计)