作者:钟剑华  历史版本:1  最后编辑:Eddy  更新时间:2024-11-15 09:05

错误提示

    javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
    at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1972)
    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:642)
    at javax.mail.Service.connect(Service.java:317)
    at javax.mail.Service.connect(Service.java:176)
    at javax.mail.Service.connect(Service.java:125)
    at javax.mail.Transport.send0(Transport.java:194)
    at javax.mail.Transport.send(Transport.java:124)

原因

Java8-291之后 , 禁用了TLS1.1

解决办法

修改java.security文件

  1. 找到jre的java.security文件,在 {JAVA_HOME}/jre/lib/security中
  2. 打开java.security并搜索 “jdk.tls.disabledAlgorithms=”
    jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
     DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL
  3. 删掉TLSv1, TLSv1.1
    jdk.tls.disabledAlgorithms=SSLv3, RC4, DES, MD5withRSA, \
     DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL