Spring發郵件-Unable to locate provider for protocol: smtp

 

依賴以下:java

[INFO] |  +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.1:compile

 

異常以下:linux

org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.NoSuchProviderException: Unable to locate provider for protocol: smtp. Failed messages: javax.mail.NoSuchProviderException: Unable to locate provider for protocol: smtp; message exception details (1) are:
Failed message 1:
javax.mail.NoSuchProviderException: Unable to locate provider for protocol: smtp
        at javax.mail.Session.getProvider(Session.java:237)
        at javax.mail.Session.getTransport(Session.java:346)
        at org.springframework.mail.javamail.JavaMailSenderImpl.getTransport(JavaMailSenderImpl.java:459)
        at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:388)
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340)
        at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:336)

 

解決方案:spring

參考apache

http://comments.gmane.org/gmane.comp.java.servicemix.user/5205

 

替換上述依賴jar包爲:ide

activation-1.1.jar
mail-1.4.jar

 

具體緣由:搜索引擎

linux下,沒法使用上述依賴的包。替換後,done!!!spa

 

本身的一些感悟:code

你遇到的問題,基本上都已經有人遇到了。畢竟,你在使用別人開發的技術。因此,必定要善於利用搜索引擎和多多總結。
相關文章
相關標籤/搜索