我也遇到过这个问题,导入邮件服务器和CA的证书后,问题依旧。
作为一般规则,通过添加选项启用 SSL 调试
-Djavax.net.debug=ssl
这显示了加载的实际密钥库和证书。
在我的特定情况下,原因非常令人惊讶:Avast 防病毒在我的应用程序服务器(WildFly)和远程 TLS 连接之间做中间人:O
以下是日志:
15:49:57,112 INFO [stdout] (default task-56) chain [0] = [
15:49:57,112 INFO [stdout] (default task-56) [
15:49:57,113 INFO [stdout] (default task-56) Version: V3
15:49:57,113 INFO [stdout] (default task-56) Subject: CN=mail.irisel.com, O=Irisel Consulting SL, L=Tres Cantos, ST=Madrid, C=ES
15:49:57,114 INFO [stdout] (default task-56) Signature Algorithm: SHA1withRSA, OID = 1.2.840.113549.1.1.5
15:49:57,114 INFO [stdout] (default task-56)
15:49:57,115 INFO [stdout] (default task-56) Key: Sun RSA public key, 1024 bits
15:49:57,116 INFO [stdout] (default task-56) modulus: 138674107939081515882972971404534700919819495458616389928335346488718131998599706435849369388241463110190321699739219608756226058473158126297068838696077495178250043211055383692800846587509903813185937024462913474510326460163355093830472808797012578670617819870186505308700964920784184093349004872582841740643
15:49:57,116 INFO [stdout] (default task-56) public exponent: 65537
15:49:57,117 INFO [stdout] (default task-56) Validity: [From: Thu Oct 01 11:52:40 CEST 2015,
15:49:57,117 INFO [stdout] (default task-56) To: Tue Oct 09 11:52:40 CEST 2040]
15:49:57,118 INFO [stdout] (default task-56) Issuer: CN=Avast Web/Mail Shield Root, O=Avast Web/Mail Shield, OU=generated by Avast Antivirus for SSL/TLS scanning
15:49:57,118 INFO [stdout] (default task-56) SerialNumber: [ 456c195d c1429a4b a1b6da53 c03eb04b]
通常我认为防病毒软件产生的问题比它们解决的问题多……