无法通过jenkins发送邮件,获得例外

时间:2017-07-14 15:24:19

标签: jenkins jenkins-plugins jenkins-pipeline jenkins-cli

我正在尝试在Jenkins中设置电子邮件通知

但是当我点击“测试配置”时,我收到了以下错误

参考附加屏幕截图以及错误

请帮助我被困在这里。

sun.security.provider.certpath.SunCertPathBuilderException:无法找到所请求目标的有效证书路径

at sun.security.provider.certpath.SunCertPathBuilder.build(Unknown Source)

at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(Unknown Source)

at java.security.cert.CertPathBuilder.build(Unknown Source)

引起:sun.security.validator.ValidatorException:PKIX路径构建失败

at sun.security.validator.PKIXValidator.doBuild(Unknown Source)

at sun.security.validator.PKIXValidator.engineValidate(Unknown Source)

at sun.security.validator.Validator.validate(Unknown Source)

at sun.security.ssl.X509TrustManagerImpl.validate(Unknown Source)

at sun.security.ssl.X509TrustManagerImpl.checkTrusted(Unknown Source)

at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(Unknown Source)

引起:javax.net.ssl.SSLHandshakeException

at sun.security.ssl.Alerts.getSSLException(Unknown Source)

at sun.security.ssl.SSLSocketImpl.fatal(Unknown Source)

at sun.security.ssl.Handshaker.fatalSE(Unknown Source)

at sun.security.ssl.Handshaker.fatalSE(Unknown Source)

at sun.security.ssl.ClientHandshaker.serverCertificate(Unknown Source)

at sun.security.ssl.ClientHandshaker.processMessage(Unknown Source)

at sun.security.ssl.Handshaker.processLoop(Unknown Source)

at sun.security.ssl.Handshaker.process_record(Unknown Source)

at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)

at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)

at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)

at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)

at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:507)

at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)

at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)

问题:javax.mail.MessagingException:无法连接到SMTP主机:smtp.gmail.com,port:465;   嵌套异常是:     javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException:PKIX路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到所请求目标的有效证书路径

at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)

at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)

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)

at hudson.tasks.Mailer$DescriptorImpl.doSendTestMail(Mailer.java:581)

at java.lang.invoke.MethodHandle.invokeWithArguments(Unknown Source)

at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343)

at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184)

at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117)

at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:129)

at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)

at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)

at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)

at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:248)

at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)

at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715)

at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845)

at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)

at org.kohsuke.stapler.Stapler.service(Stapler.java:238)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:841)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)

at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)

at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:138)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)

at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)

at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)

at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)

at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)

at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)

at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)

at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)

at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)

at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)

at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)

at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)

at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)

at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)

at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)

at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)

at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)

at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)

at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)

at org.eclipse.jetty.server.Server.handle(Server.java:564)

at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)

at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)

at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)

at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)

at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)

at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)

at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)

at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:199)

at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)

at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

1 个答案:

答案 0 :(得分:0)

您是否配置了gmail以访问低安全性应用。如果你没有完成,请检查一下。如果您有任何新的插件更新,请更新插件。如果发现错误,您将面临认证问题。

按照认证问题的步骤进行操作:

您需要导入smtp.gmail.com证书

1)输入命令以查看此证书

C:\openssl\bin\openssl.exe s_client -connect smtp.gmail.com:465

2)复制复制并保存两者之间的线 " -----开始证书-----"

" -----结束证书-----"到文件中,例如:-gmail.cer

3)使用此命令导出      keytool -import -alias smtp.gmail.com -keystore"%JAVA_HOME%/ jre / lib / security / cacerts" -file C:\ Users \ ca \ Desktop \ gmail \ gmail.cer

4)输入密码chageit

5)单击“是”以导入证书

6)重启java

希望它适合你