2013-12-14 48 views
1

如何爲在Windows上運行的Jenkins啓用STARTTLS?在Windows上Jenkins - 無法連接到SMTP主機,「無法識別的SSL消息」

我有一個Windows 2008服務器上運行詹金斯,我的電子郵件通知與下列信息配置:

  • 主持人:smtp.office365.com
  • 端口:587
  • SMTP驗證:真
  • SSL:真
  • 等...

當我運行一個測試,我得到下面的異常消息:

javax.mail.MessagingException: Could not connect to SMTP host: smtp.office365.com, port: 587; 
    nested exception is: 
    javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? 

這個問題似乎是由於使用STARTTLS此連接的安全smtp.office365.com。我試圖通過jenkins.xml配置文件,使STARTTLS,通過添加以下參數:

-Dmail.smtp.starttls.enable =真

  1. 這是正確的開關/參數?
  2. jenkins.xml正確的文件更新?

注意:我知道,有些人已經在他們的Linux環境下解決了這個,但我要尋找一個解決方案,它具體到Windows。以下是我當前jenkins.xml文件的一個片段:

<service> 
    <id>jenkins</id> 
    <name>Jenkins</name> 
    <description>This service runs Jenkins continuous integration system.</description> 
    <env name="JENKINS_HOME" value="%BASE%"/> 

    <!-- 
    if you'd like to run Jenkins with a specific version of Java, specify a full path to java.exe. 
    The following value assumes that you have java in your PATH. 
    --> 
    <executable>%BASE%\jre\bin\java</executable> 
    <arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "%BASE%\jenkins.war" --httpPort=8080 -Dmail.smtp.starttls.enable=true</arguments> 
    <!-- 
    interactive flag causes the empty black Java window to be displayed. 
    I'm still debugging this. 
    <interactive /> 
    --> 
    <logmode>rotate</logmode> 

    <onfailure action="restart" /> 
</service> 
+0

你找到這是一個解決方案嗎? – landi

回答

0

我認爲參數順序很重要。我必須在-jar參數前加上-Dmail.smtp.starttls.enable = true。

-Xrs -Xmx256m -Dhudson.lifecycle = hudson.lifecycle.WindowsServiceLifecycle -Dmail.smtp.starttls.enable =真正的罐子 「%BASE%\ jenkins.war」 --httpPort = 8080

相關問題