从Jenkins发送通知电子邮件?

时间:2014-11-12 05:32:52

标签: java email jenkins server

我正在尝试为我们公司的构建自动化设置jenkins。当构建完成时,我想从jenkins发送电子邮件通知。我安装了email-ext并尝试配置它。我单独提供了SMTP服务器和端口,并尝试了测试电子邮件。然后我收到以下错误。我是新手,请帮忙。

javax.mail.MessagingException: Could not connect to SMTP host: xxx.xxx.xxx.xxx, port: 25;
  nested exception is:
    java.net.BindException: Cannot assign requested address: connect

    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:295)

    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:527)

    at sun.reflect.GeneratedMethodAccessor248.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke(Method.java:606)

    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)

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

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

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

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

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

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

    at org.kohsuke.stapler.MetaClass$6.doDispatch(MetaClass.java:249)

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

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

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

    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:722)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

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

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

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

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

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

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

    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)

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

    at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)

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

    at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)

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

    at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)

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

    at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)

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

    at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:86)

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

    at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)

    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)

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

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

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

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

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

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

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

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

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

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)

    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)

    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:576)

    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)

    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)

    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)

    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)

    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)

    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)

    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)

    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

    at java.lang.Thread.run(Thread.java:744)

Caused by: java.net.BindException: Cannot assign requested address: connect

    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)

    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)

    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)

    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)

    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)

    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

    at java.net.Socket.connect(Socket.java:579)

    at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:286)

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

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

    ... 76 more

我也收到了以下错误"It appears that your reverse proxy set up is broken."我用Google搜索了但我对此一无所知......请帮助我。 我使用的Jenkins版本是1.588

1 个答案:

答案 0 :(得分:0)

请检查以下内容:

  • 尝试验证SMTP邮件服务器的主机名/ IP是否为 是否正确。
  • 确保/ etc / hosts文件中没有提供的ip或主机名的主机条目。
  • Telnet SMTP邮件服务器查看是否可以连接 建立与否。通常在企业中,他们将其他白名单列入其中 默认端口(25)。请咨询您的IT团队并确认IP和 再次出口。
  • 如果使用IPv6可能还有其他原因,请尝试 通过添加以下jvm参数连接并尝试连接 IPv4参数如下:

    -Djava.net.preferIPv4Stack =真