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

And a typical example would be
An exception was encountered.

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


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.