Mail server at location [java:comp/env/mail/GmailSmtpServer] is not of required type javax.mail.Session

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

When adding a JNDI setting to an email server (specially if you are connecting your instance to Gmail), the following error is displayed:

(Auto-migrated image: description temporarily unavailable)

The mail settings you entered were not valid. Error thrown was: Mail server at location [java:comp/env/mail/GmailSmtpServer] is not of required type javax.mail.Session.

Cause

As explained on Configuring Bamboo to send SMTP Email, you need to ensure that the files mail-X.X.jar and activation-X.X.jar exist only in the <Bamboo_Install>/lib directory.

The error occurs if the files exist both in <Bamboo-Install>/atlassian-bamboo/WEB-INF/lib and <Bamboo_Install>/lib.

Resolution

Removing the duplicate files will solve the problem.

  1. Shutdown Bamboo;

  2. Delete the <Bamboo_Install>/lib/mail-X.X.jar and <Bamboo_Install>/lib/activation-X.X.jar

  3. Restart Bamboo and attempt to reconfigure your mail server again.

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.