[英]java.net.SocketException: Broken pipe with SMTP
當我的應用程序嘗試發送電子郵件時,出現異常行為。
20:59:08,926 ERROR [release.com.mycompany.mail.GenericMail] (EJB default - 5) [MY_EJB INBOUND] Sending message failed!: javax.mail.MessagingException: Can't send command to SMTP host;
nested exception is:
java.net.SocketException: Broken pipe
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2106) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
at com.sun.mail.smtp.SMTPTransport.sendCommand(SMTPTransport.java:2093) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
at com.sun.mail.smtp.SMTPTransport.close(SMTPTransport.java:1184) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
at javax.mail.Transport.send0(Transport.java:197) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
at javax.mail.Transport.send(Transport.java:124) [mail-1.4.4-redhat-2.jar:1.4.4-redhat-2]
at com.mycompany.MailUtils.sendMail(MailUtils.java:258) [classes:]
在此異常之前,拋出了一些超時異常:
20:57:50,291 ERROR [org.jboss.as.ejb3] (EJB default - 9) [ ] JBAS014122: Error during
retrying timeout for timer: [id=6be904b5-c1ef-4f0e-a277-d4c9f93e21b3 timedObjectId=SOME_EJB
auto-timer?:false persistent?:false timerService=org.jboss.as.ejb3.timerservice.TimerServiceImpl@99fdab1 initialExpiration=/* date */ 00:00:00 UTC 2015 intervalDuration(in milli sec)=0 nextExpiration=/* other date */ 21:00:00 UTC 2015
timerState=RETRY_TIMEOUT: javax.ejb.EJBTransactionRolledbackException: JBAS014373:
EJB 3.1 PFD2 4.8.5.5.1 concurrent access timeout on org.jboss.invocation.InterceptorContext$Invocation@66668127 - could not obtain lock within 5000MILLISECONDS
老實說,我不知道發生了什么。 我在5個小時內遇到了此類異常。 我想知道發生了什么,並且將來能夠避免出現異常情況。
更新1
SOME_EJB
是可與timerService一起使用的ejb。 當滿足條件時,每3分鍾運行一次,發送一封電子郵件。
我唯一的想法是存在一些網絡/數據庫問題,導致單個任務執行花費了3分鍾以上。
MailUtils
是@Stateless
的EJB
郵件是否發送?
發生異常時,看起來JavaMail正在關閉與郵件服務器的連接。 如果先前的錯誤導致服務器立即斷開連接,則JavaMail在關閉連接之前嘗試發送SMTP BYE命令時可能會收到此異常。
打開JavaMail Session調試以查看在發生此異常之前服務器可能報告了什么錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.