本地开发的代码 使用到了
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
spring的邮件starter。本地使用oracle jdk8.服务器使用openjdk8。在我的潜意识里面是认为这俩基本没有区别的。在本地测试通过都是正常。
但是放到服务器上面的时候 无法调用成功。
Mail server connection failed; nested exception is javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty. Failed messages: javax.mail.MessagingException: Exception reading response;
nested exception is:
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
抛出的异常。查了资料才发现在openjdk中是没有这个东西的。
解决方案就是升级openjdk8 -> openjdk11 升级成功发现没有抛错
这个时候Java的新版本完美兼容老版本的代码就发挥用处了。升级jdk之后重新运行运行成功。
版权声明:本文为博主原创文章,未经博主允许不得转载。



