gpt4 book ai didi

javamail java.io.IOException : Invalid keystore format

转载 作者:行者123 更新时间:2023-12-01 15:14:40 31 4
gpt4 key购买 nike

我正在尝试使用 javamail 发送电子邮件,在我的本地计算机上,当我运行我的类(class)时,邮件可以很好地发送。

在生产计算机上我收到错误:

Caused by: javax.mail.MessagingException: Could not convert socket to TLS (java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl))
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1230)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:378)
at javax.mail.Service.connect(Service.java:271)
at javax.mail.Service.connect(Service.java:91)
at javax.mail.Service.connect(Service.java:76)
at javax.mail.Transport.send(Transport.java:94)
... 8 more
Caused by: java.net.SocketException: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at javax.net.ssl.DefaultSSLSocketFactory.throwException(SSLSocketFactory.java:179)
at javax.net.ssl.DefaultSSLSocketFactory.createSocket(SSLSocketFactory.java:199)
at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:249)
at com.sun.mail.smtp.SMTPTransport.startTLS(SMTPTransport.java:1226)
... 13 more
Caused by: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl)
at java.security.Provider$Service.newInstance(Provider.java:1245)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:220)
at sun.security.jca.GetInstance.getInstance(GetInstance.java:147)
at javax.net.ssl.SSLContext.getInstance(SSLContext.java:125)
at javax.net.ssl.SSLContext.getDefault(SSLContext.java:68)
at javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:102)
at com.sun.mail.util.SocketFetcher.startTLS(SocketFetcher.java:247)
... 14 more
Caused by: java.io.IOException: Invalid keystore format
at sun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:633)
at sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:38)
at java.security.KeyStore.load(KeyStore.java:1185)
at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.getDefaultKeyManager(DefaultSSLContextImpl.java:150)
at com.sun.net.ssl.internal.ssl.DefaultSSLContextImpl.<init>(DefaultSSLContextImpl.java:40)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at java.security.Provider$Service.newInstance(Provider.java:1221)
... 20 more

在安全路径中有这些文件:

68595 Mar  9  2009 cacerts
2221 Mar 9 2009 java.policy
9937 Mar 9 2009 java.security
132 Mar 9 2009 javaws.policy
2940 Mar 9 2009 _local_policy.jar
2481 Feb 28 12:54 local_policy.jar
2469 Mar 9 2009 _US_export_policy.jar
2465 Feb 28 12:54 US_export_policy.jar

没有 trust.certs 文件。

生产使用jdk 1.6.0_13,是否可能某些文件太旧?另一个细节是生产中一切都运行良好,直到上周一(7/30)代码没有任何变化,现在我收到了这个错误。

很难找出问题所在,因为我什至不知道哪个文件有问题。如果您有任何想法,我会接受!

感谢您的帮助!

最佳答案

最后问题是管理员定义了自定义 keyStore :

-Djavax.net.ssl.keyStore=xxxxxxx.p12

它缺少这个:

-Djavax.net.ssl.keyStoreType=pkcs12

关于javamail java.io.IOException : Invalid keystore format,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11797329/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com