Setting up email notifications

This will use the email address set in the email notifications OA4MP automatically configures a set of listeners internally that will generate email notifications whenever an exception is thrown in the server. All you need to do is specify two files, one that contains the subject and one that contains the body. The format for these files is very simple.

Getting the right servlet context parameters

In the deployment descriptor, web.xml, you should specify the fully qualified names of the subject file:
<context-param>
      <param-name>oa4mp:server.error.subject</param-name>
      <param-value>/var/www/config/errorSubject.template</param-value>
  </context-param>
The typical contents of such a file would be
Error caught by ${servletEngine}  on ${host}
in while the ${servletEngine} (e.g. Tomcat, Jetty) and ${host} would be replaced by their runtime values.

The body of the generated email message is specified in much the same way:

<context-param>
      <param-name>oa4mp:server.error.message</param-name>
      <param-value>/var/www/config/errorMessage.template</param-value>
  </context-param>
And a typical example would be
An exception was encountered.

Error Report:
------------
Error: ${message}
Host: ${host}
Client: ${client}
Servlet: ${servlet}
URL: ${url}


Cookies:
-------
${cookies}


Exception:
---------
${stacktrace}
where the following values hold:
  • ${message} is the message in the stack trace
  • ${host} is the name of the server
  • ${client} is the identifier of the client that made the request
  • ${servlet} is the name of the servlet (e.g. CertServlet) where the exception was encountered
  • ${url} is the url of the request
  • ${cookies} is a list of every cookie that the servlet has access to
  • ${stacktrace} is the full stacktrace of the exception.

Last modified 10/25/18.
©2000-2013 Board of Trustees of the University of Illinois.