EmailFactory Issue dotcms 3.3

14 views
Skip to first unread message

Vikrant Nimbalkar

unread,
Aug 30, 2016, 12:40:38 PM8/30/16
to dotCMS User Group
Hi All,

Recently i faced the following exception while sending mail

com.dotmarketing.exception.DotRuntimeException: Unable to send the email
at com.dotmarketing.factories.EmailFactory.sendParameterizedEmail(EmailFactory.java:562)

Because of this, emails were not sent. May is know what might have caused the exception. Later it started working fine. But then i am bit confused why did this occur in the first place.Please help.

Jason Tesser

unread,
Aug 30, 2016, 12:45:43 PM8/30/16
to dotCMS User Group
really hard to say with just that bit of the log.  Maybe something with the SMTP server 

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/ad5bd483-5114-4eeb-af7f-8610cc71b73c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Vikrant Nimbalkar

unread,
Aug 30, 2016, 12:57:30 PM8/30/16
to dotCMS User Group
Hi Lords,
Thank you for the reply.
I totally agree. There might be SMTP server issue.But i need some idea to dig into this issue.  its been bothering me for long time.

Thanks and Regards
Vikrantraje

Jason Tesser

unread,
Aug 30, 2016, 12:58:46 PM8/30/16
to dotCMS User Group
i would check theSMTP logs around the time u saw it happen
See what it was doing 

Vikrant Nimbalkar

unread,
Aug 30, 2016, 1:02:48 PM8/30/16
to dotCMS User Group
Sure. I will go through the smtp logs. But SMTP server is maintained by third party agents. Until i get those logs , is their any possible way i can debug and find this issue?

Thanks and Regards
Vikrantraje

Jason Tesser

unread,
Aug 30, 2016, 1:05:32 PM8/30/16
to dotCMS User Group
not unless you had more info in our logs but we don't always get back what heppened at the SMTP side 

Vikrant Nimbalkar

unread,
Aug 30, 2016, 1:14:34 PM8/30/16
to dotCMS User Group
else {
     if(formBean != null){
try {
HibernateUtil.delete(formBean);
} catch (DotHibernateException e) {
Logger.error(EmailFactory.class, e.getMessage(), e);
}
   }
throw new DotRuntimeException("Unable to send the email");
}

Above is the code snippet where runtime error is thrown.You can find this code in EmailFactory class.

Nathan Keiter

unread,
Aug 30, 2016, 1:18:23 PM8/30/16
to dot...@googlegroups.com

For exactly this reason we wrote a class override for com.dotmarketing.util.Mailer.  It saves a copy of any email attempt to the database with a success/fail flag indicating errors on the dotCMS side.

 

Later on, we run a servlet which finds any failed mail in that table and tries to resend it.

 

Fortunately we haven’t had major issues lately, but this will save us if we ever have one again.

 

We also have an override for com.dotmarketing.factories.EmailFactory which stops it from deleting the form bean just because the email failed.  (Which was silly, because we want the form data stored regardless of the email being sent successfully.)

 

Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Health Care Advisory Group Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

Vikrant Nimbalkar

unread,
Aug 30, 2016, 1:31:31 PM8/30/16
to dotCMS User Group
There are two points which i understood from our discussion.Please correct me if i am wrong.

1) Save mail content to database so that re-delivery of the mail is possible
2) Overide EmailFactory to stop deleting form bean.

Surely will implement point 1.Now coming to point2 , i have few queries.


On Tuesday, August 30, 2016 at 10:48:23 PM UTC+5:30, Nathan Keiter wrote:

For exactly this reason we wrote a class override for com.dotmarketing.util.Mailer.  It saves a copy of any email attempt to the database with a success/fail flag indicating errors on the dotCMS side.

 

Later on, we run a servlet which finds any failed mail in that table and tries to resend it.

 

Fortunately we haven’t had major issues lately, but this will save us if we ever have one again.

why is it necessary to stop deleteing formbean since its already saved? 

WebForm formBean = saveFormBean(parameters, host, formType, ignoreString, filesLinks);

 

Thanks and Regards
Vikrantraje 

Nathan Keiter

unread,
Aug 30, 2016, 1:32:10 PM8/30/16
to dot...@googlegroups.com

You might be able to find the email in {install-root}\dotserver\tomcat-8.0.18\webapps\ROOT\email_backups\

 

Once you identify the email that was missing (by error timestamp), you can then match it to your access logs to see what form they tried to submit.

 

We had to do this once for hundreds of forms, which is a very painful process. (And why we introduced our override classes.)

 

Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Health Care Advisory Group Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

Nathan Keiter

unread,
Aug 30, 2016, 1:37:11 PM8/30/16
to dot...@googlegroups.com

Because if the return is false from m.sendMessage() https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L514

 

This code block runs: https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L562-L571

 

And then the form you just saved is deleted.

 

HibernateUtil.delete(formBean);

 

https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L565

 

So in a nutshell, if the mailer fails, it scrubs the database of that submission.

Vikrant Nimbalkar

unread,
Aug 30, 2016, 1:51:48 PM8/30/16
to dot...@googlegroups.com
got it.. lets say i am not concerned about saving/backup mail part for a moment. From code as we can see,firstly it will save form bean,then 
send mail , if mail fails delete again(which as u said is silly).But my concern now is with sending the mail.
Does deleting formBean where the exception has occured , anything to do with m.sendMessage()? or the error has nothing to do with sending email?

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/9ae43268-aea4-49e8-a5c2-8cca2a547906%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/04oXJepknmo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dotcms+unsubscribe@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Thanks and regards,
Vikrantraje

Nathan Keiter

unread,
Aug 30, 2016, 1:55:58 PM8/30/16
to dot...@googlegroups.com

The error is created fresh in that code block by dotCMS. https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L570

 

All it really means is that mailer.sendMessage() returned false.

 

If you want more detailed error handling, you should capture the real error in com.dotmarketing.util.Mailer.

 

Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Health Care Advisory Group Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: dot...@googlegroups.com [mailto:dot...@googlegroups.com] On Behalf Of Vikrant Nimbalkar
Sent: Tuesday, August 30, 2016 1:52 PM
To: dot...@googlegroups.com
Subject: Re: [dotcms] EmailFactory Issue dotcms 3.3

 

got it.. lets say i am not concerned about saving/backup mail part for a moment. From code as we can see,firstly it will save form bean,then 

send mail , if mail fails delete again(which as u said is silly).But my concern now is with sending the mail.

Does deleting formBean where the exception has occured , anything to do with m.sendMessage()? or the error has nothing to do with sending email?

On Tue, Aug 30, 2016 at 11:07 PM, Nathan Keiter <nke...@gettysburg.edu> wrote:

Because if the return is false from m.sendMessage() https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L514

 

This code block runs: https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L562-L571

 

And then the form you just saved is deleted.

 

HibernateUtil.delete(formBean);

 

https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L565

 

So in a nutshell, if the mailer fails, it scrubs the database of that submission.

 

Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Health Care Advisory Group Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: dot...@googlegroups.com [mailto:dot...@googlegroups.com] On Behalf Of Vikrant Nimbalkar

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/04oXJepknmo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to dotcms+un...@googlegroups.com.


To post to this group, send email to dot...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.



 

--

Thanks and regards,

Vikrantraje

--

http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

Nathan Keiter

unread,
Aug 30, 2016, 1:58:56 PM8/30/16
to dot...@googlegroups.com

Just FYI, the default Mailer class should be writing to your error log.  Any logging activity near the other error?

 

Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Health Care Advisory Group Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: dot...@googlegroups.com [mailto:dot...@googlegroups.com] On Behalf Of Nathan Keiter


Sent: Tuesday, August 30, 2016 1:56 PM
To: dot...@googlegroups.com

Vikrant Nimbalkar

unread,
Aug 30, 2016, 2:00:26 PM8/30/16
to dot...@googlegroups.com

I better try to get error for further analysis. But yes as u said , there is no need to delete formbean if mail fails.Need to override Emailfactory class.Thanks for spending time and helping.


To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.


To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/9ae43268-aea4-49e8-a5c2-8cca2a547906%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/04oXJepknmo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to dotcms+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.



 

--

Thanks and regards,

Vikrantraje

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/04oXJepknmo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dotcms+unsubscribe@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.

Vikrant Nimbalkar

unread,
Aug 30, 2016, 2:04:51 PM8/30/16
to dot...@googlegroups.com

I have not checked..I will check other logs too.


To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.


To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/9ae43268-aea4-49e8-a5c2-8cca2a547906%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/04oXJepknmo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to dotcms+unsubscribe@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.



 

--

Thanks and regards,

Vikrantraje

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+unsubscribe@googlegroups.com.


To post to this group, send email to dot...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dotcms/31c0429fde8c404b91e288b9d9d2a35a%40exch13c.ms.gettysburg.edu.
For more options, visit https://groups.google.com/d/optout.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/04oXJepknmo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dotcms+unsubscribe@googlegroups.com.

To post to this group, send email to dot...@googlegroups.com.

Nathan Keiter

unread,
Aug 30, 2016, 2:05:56 PM8/30/16
to dot...@googlegroups.com

Should be in dotcms.log chronologically near the one you saw.

 

Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Health Care Advisory Group Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: dot...@googlegroups.com [mailto:dot...@googlegroups.com] On Behalf Of Vikrant Nimbalkar
Sent: Tuesday, August 30, 2016 2:05 PM
To: dot...@googlegroups.com
Subject: RE: [dotcms] EmailFactory Issue dotcms 3.3

 

I have not checked..I will check other logs too.

 

On Aug 30, 2016 23:28, "Nathan Keiter" <nke...@gettysburg.edu> wrote:

Just FYI, the default Mailer class should be writing to your error log.  Any logging activity near the other error?

 

Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Health Care Advisory Group Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: dot...@googlegroups.com [mailto:dot...@googlegroups.com] On Behalf Of Nathan Keiter
Sent: Tuesday, August 30, 2016 1:56 PM
To: dot...@googlegroups.com
Subject: RE: [dotcms] EmailFactory Issue dotcms 3.3

 

The error is created fresh in that code block by dotCMS. https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L570

 

All it really means is that mailer.sendMessage() returned false.

 

If you want more detailed error handling, you should capture the real error in com.dotmarketing.util.Mailer.

 

Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Health Care Advisory Group Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: dot...@googlegroups.com [mailto:dot...@googlegroups.com] On Behalf Of Vikrant Nimbalkar
Sent: Tuesday, August 30, 2016 1:52 PM
To: dot...@googlegroups.com
Subject: Re: [dotcms] EmailFactory Issue dotcms 3.3

 

got it.. lets say i am not concerned about saving/backup mail part for a moment. From code as we can see,firstly it will save form bean,then 

send mail , if mail fails delete again(which as u said is silly).But my concern now is with sending the mail.

Does deleting formBean where the exception has occured , anything to do with m.sendMessage()? or the error has nothing to do with sending email?

On Tue, Aug 30, 2016 at 11:07 PM, Nathan Keiter <nke...@gettysburg.edu> wrote:

Because if the return is false from m.sendMessage() https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L514

 

This code block runs: https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L562-L571

 

And then the form you just saved is deleted.

 

HibernateUtil.delete(formBean);

 

https://github.com/dotCMS/core/blob/master-3.6/src/com/dotmarketing/factories/EmailFactory.java#L565

 

So in a nutshell, if the mailer fails, it scrubs the database of that submission.

 

Nathan I. Keiter | Lead Network Applications Programmer | Administrative Advisory Council Member | Health Care Advisory Group Member | I.D.E.A Council Member
Gettysburg College | Information Technology | DataSystems
Campus Box 2453 | 300 North Washington Street | Gettysburg, PA 17325
Phone: 717.337.6993

https://www.gettysburg.edu

 

From: dot...@googlegroups.com [mailto:dot...@googlegroups.com] On Behalf Of Vikrant Nimbalkar

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/04oXJepknmo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to dotcms+un...@googlegroups.com.


To post to this group, send email to dot...@googlegroups.com.


For more options, visit https://groups.google.com/d/optout.



 

--

Thanks and regards,

Vikrantraje

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.

To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

--
http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to a topic in the Google Groups "dotCMS User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dotcms/04oXJepknmo/unsubscribe.

To unsubscribe from this group and all its topics, send an email to dotcms+un...@googlegroups.com.


To post to this group, send email to dot...@googlegroups.com.

--

http://dotcms.com - Open Source Java Content Management
---
You received this message because you are subscribed to the Google Groups "dotCMS User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dotcms+un...@googlegroups.com.
To post to this group, send email to dot...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages