简体   繁体   English

java.net.SocketException:SMTP管道损坏

[英]java.net.SocketException: Broken pipe with SMTP

I got strange behavior when my application tries to send an email. 当我的应用程序尝试发送电子邮件时,出现异常行为。

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:]

Before this exception some timeout exception has been thrown: 在此异常之前,抛出了一些超时异常:

    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

To be honest i don't know whats happened. 老实说,我不知道发生了什么。 I got these kind of exception for 5 hours. 我在5个小时内遇到了此类异常。 I want to know whats happened and be able to avoid exceptions in future. 我想知道发生了什么,并且将来能够避免出现异常情况。

UPDATE 1 更新1

SOME_EJB is an ejb with works with timerService. SOME_EJB是可与timerService一起使用的ejb。 Runs every 3 minutes, when the conditions are met sends an email. 当满足条件时,每3分钟运行一次,发送一封电子邮件。

My only idea is that there was some network/database issue and it caused that single execution of task took more than 3 minutes. 我唯一的想法是存在一些网络/数据库问题,导致单个任务执行花费了3分钟以上。

MailUtils is a @Stateless ejb MailUtils@Stateless的EJB

Is the mail sent or not? 邮件是否发送?

It looks like JavaMail is closing the connection to the mail server when the exception occurs. 发生异常时,看起来JavaMail正在关闭与邮件服务器的连接。 If a previous error caused the server to drop the connection immediately, JavaMail may be getting this exception while trying to send the SMTP BYE command before closing the connection. 如果先前的错误导致服务器立即断开连接,则JavaMail在关闭连接之前尝试发送SMTP BYE命令时可能会收到此异常。

Turn on JavaMail Session debugging to see what error the server might have reported before this exception occurs. 打开JavaMail Session调试以查看在发生此异常之前服务器可能报告了什么错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM