Mail server at location is not of required type javax.mail.Session

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

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


The following error is displayed when adding a JNDI setting to an email server (especially if you are connecting your instance to Gmail). This is also commonly seen after an upgrade if you had JNDI configured for your email server.

The following appears in the atlassian-confluence.log:

An error has occurred with sending the test email:
java.lang.IllegalArgumentException: Mail server at location [java:comp/env/mail/GmailSMTPServer] is not of required type javax.mail.Session.


As explained on Setting Up a Mail Session for the Confluence Distribution, you need to ensure that you move (don't copy) mail-x.x.x.jar from <confluence-install>\confluence\WEB-INF\lib to <confluence-install>\lib (x.x.x. represents the version numbers on the jar files in your installation).

Don't leave a renamed backup of the jar files in \confluence\WEB-INF\lib. Even with a different file name, the files will still be loaded as long as it remains in the directory.


Removing the duplicate file should solve the problem.

  1. Shutdown Confluence
  2. Delete the mail-x.x.x.jar from <confluence-install>\confluence\WEB-INF\lib
  3. Restart Confluence and attempt to reconfigure your mail server again.


This is being tracked at in the following for a permanent resolution:  CONF-43358 - Getting issue details... STATUS


Last modified on Nov 2, 2018

Was this helpful?

Provide feedback about this article
Powered by Confluence and Scroll Viewport.