I’ve been working on a Grails application that sends reminder emails using the Grails Mail plugin. Everything was working fine when I tested it locally. But when I deployed it to the test server, I started seeing the following exception every time it tried to send an email (I’ll spare you the long stacktrace)…

I Googled around and found a number of articles and blog posts that all said the same thing – that the host name is not properly set on the server. In my case, the server host name was set just fine. I was left scratching my head until I found one StackOverflow post that referenced the /etc/hosts file. I took a peak at the server and realized that the hosts file was complete wrong. Instead of

it was…

…a simple mistake by the sysadmin. But it completely broke the Java Mail API.

This mistake was also causing the following ehCache exception during app startup.

A simple change to the /etc/hosts solved both problems.

Like this post? Please share it! Then follow us on Twitter – @thorntech – and sign up for our email list below for future updates.

[grwebform url=”https://app.getresponse.com/view_webform_v2.js?u=BK4gP&webforms_id=2855304″ css=”on” center=”off” center_margin=”200″/]