Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaMail not able to reslove hostname coming from one of the Unix server

 
Vrunda Bapat
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
We are using JavaMail to send Mails via Java Application.

JavaMail is using relay server to relay mail.
Relay server is not able to relay the mail and fails with just sendException : Mail Server failed to Relay message and nothing more than that.
We get hostname like this : String currentHost = InetAddress.getLocalHost().getHostName();

According to API documentation: InetAddress.getHostName() is doing a reverse lookup on the server's IP address using the naming service (DNS) configured in your O/S.

hosname returns as mcc12345
In server configuration : /etc/hosts file

xxx.xx.xx.3 mcc12345-blah.com mcc12345-blah.com loghost
xxx.xx.xx.51 mcc12345-data.blah mcc12345 mcc12345-blah mcc12345-blah.com


Since InetAddress.getLocalHost().getHostName() returns mcc12345
JavaMail is not able to resolve it to fully qualified address.

Is there any change in /etc/hosts configuration file which would help return the correct Host name?

What else can be done other than using another method call - InetAddress.getLocalHost().getCanonicalHostName()?
Code Change is NOT an welcome OPTION at this point , so looking at configuration changes on Server to help..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic