permaculture playing cards*
The moose likes Other JSE/JEE APIs and the fly likes Intermittent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Intermittent "javax.mail.SendFailedException: Sending failed" error" Watch "Intermittent "javax.mail.SendFailedException: Sending failed" error" New topic
Author

Intermittent "javax.mail.SendFailedException: Sending failed" error

Jaine Steer
Greenhorn

Joined: Dec 05, 2011
Posts: 2
I am using an application that is supposed to send up to 6 notifications. This is not happening consistently - sometimes I get all 6, sometimes the 4,5 or 6 is missing - in any combination. Note if #4 fails to deliver, this does not mean that #5 and/or 6 do not come through.

The error in the Oracle application server log shows the following message



11:21:10 WARN AJPRequestHandler-ApplicationServerThread-11 [ NotificationManager.sendEmail ] Sending the email to the following server failed : null:25
org.apache.commons.mail.EmailException: Sending the email to the following server failed : null:25
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:873)
at org.apache.commons.mail.Email.send(Email.java:898)
at com.intaz.safetsmart.notification.NotificationManager.sendEmail(NotificationManager.java:204)
at com.intaz.safetsmart.notification.NotificationManager.sendNotification(NotificationManager.java:130)
at com.intaz.safetsmart.workflow.action.notify.RoleIfIncidentClassification.execute(RoleIfIncidentClassification.java:110)
at com.intaz.safetsmart.workflow.Workflow.executeActionHandler(Workflow.java:531)
at com.intaz.safetsmart.workflow.Workflow.executeActionHandler(Workflow.java:438)
at com.intaz.safetsmart.workflow.WorkflowDefinition.processInitialEvent(WorkflowDefinition.java:308)
at com.intaz.safetsmart.workflow.WorkflowDefinition.processInitialEvent(WorkflowDefinition.java:161)
at com.intaz.safetsmart.workflow.WorkflowEngine.checkForNewWorkflows(WorkflowEngine.java:180)
at com.intaz.safetsmart.workflow.WorkflowEngine.processEvent(WorkflowEngine.java:92)
at com.intaz.safetsmart.presentation.generic.WizardObject.save(WizardObject.java:560)
at com.intaz.safetsmart.presentation.handler.GenericHandler.handleRequest(GenericHandler.java:469)
at com.intaz.safetsmart.presentation.ControllerServlet.performTask(ControllerServlet.java:119)
at com.intaz.safetsmart.presentation.BaseServlet.doPost(BaseServlet.java:26)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:824)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:224)
at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
at java.lang.Thread.run(Thread.java:534)
Caused by: javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.SendFailedException:
at javax.mail.Transport.send0(Transport.java:219)
at javax.mail.Transport.send(Transport.java:81)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:863)


on a different occassion, the error was

Caused by: javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.MessagingException: Could not connect to SMTP host: mail.test.xxx.xxx.xxx.au, port: 25
at javax.mail.Transport.send0(Transport.java:219)
at javax.mail.Transport.send(Transport.java:81)
at org.apache.commons.mail.Email.sendMimeMessage(Email.java:863)
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

The first exception is difficult to interpret, as the exception message is null. Can you call setDebug(true) on your email prior to sending it? That will turn on session debugging, which will help find the cause.
The second exception is clear. You can't connect to any SMTP server on port 25 on that server. Either there is no SMTP server there, or you're being blocked, or the server simply is too busy to accept any connections.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

As for the last one: you are going to have to be prepared for the possibility that the SMTP server you are using to send e-mail may not be running. You can't expect 100% reliability from any component. So you have to make a design decision about what to do when that happens. So far your decision has been that you will discard the e-mail, but apparently you aren't satisfied with that. So you're going to have to make a different decision.
Jaine Steer
Greenhorn

Joined: Dec 05, 2011
Posts: 2
Can you call setDebug(true) on your email prior to sending it? That will turn on session debugging, which will help find the cause.

I am not sure how to do this. This is an application that is provided by the vendor. I do have access to the Oracle Application server, but would not know where this type of command would go.

Also, for the second listed exception, this SMTP server has not changed. In this case, it was for a virtual system, but I have the same intermittent behaviour occurring in both physical and virtual systems. In the case of the physical system, this also hosts production for the entire 2600 strong org, so I am reasonably confident that it is not that it is up and running. I do not expect that it is that I am blocked, as all emails in the test environment are set to my own address, and it would not make sense that I do not receive (say) #5, and yet #6 comes through. How do I find out if the server is too busy? I have been shown the Microsoft Exchange server output from one of these failed email attempts, and the information in the Message subject column of the Message Tracking Results outpup is showing "wrong email".

This may be off track, but is there a way of trying to identify what went into the Exchange server?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

It sounds like there should be somebody in charge of administering the Exchange server. If you have questions about Exchange then that would definitely be the person to talk to.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Intermittent "javax.mail.SendFailedException: Sending failed" error
 
Similar Threads
Problem with sending E-mail
Automail not working
EmailException, sendMimeMessage
JavaMail UnsupportedDataTypeException in custom ClassLoader
Exception while trying to send out email thru application