Bamboo email notifications fail with NoClassDefFoundError errors
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
Summary
Users don't receive email notifications from Bamboo upon failure or success of a build or other types of notification events.
Diagnosis
- Sending a test email from the Bamboo Administration > Communication > Mail Server page works correctly and emails are received immediately.
Testing email notifications from the command line works fine. For example:
$ echo test | mail -s "Testing" username@domain.com
The following errors can be seen in the application logs:
atlassian-bamboo.log2014-05-20 10:04:52,028 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-3-thread-11] [SystemAuthorityThreadFactory] Uncaught exception in thread AtlassianEvent::0-BAM::EVENTS:pool-3-thread-11 java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit at java.awt.Color.<clinit>(Color.java:275) at cz.vutbr.web.csskit.TermColorImpl.<init>(TermColorImpl.java:30) at cz.vutbr.web.csskit.TermColorImpl.getColorByHash(TermColorImpl.java:88) ...... at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) at java.lang.Thread.run(Thread.java:722)
atlassian-bamboo.log2014-05-19 10:06:21,999 ERROR [AtlassianEvent::0-BAM::EVENTS:pool-3-thread-249] [SystemAuthorityThreadFactory] Uncaught exception in thread AtlassianEvent::0-BAM::EVENTS:pool-3-thread-249 java.lang.NoClassDefFoundError: Could not initialize class cz.vutbr.web.csskit.antlr.CSSLexer at cz.vutbr.web.csskit.antlr.CSSParserFactory.feedLexer(CSSParserFactory.java:350) at cz.vutbr.web.csskit.antlr.CSSParserFactory.createParser(CSSParserFactory.java:337) at cz.vutbr.web.csskit.antlr.CSSParserFactory.parse(CSSParserFactory.java:227) ...... at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:52) at java.lang.Thread.run(Thread.java:722)
Solution
There are a few different solutions to this problem that have been outlined here:
Solution 1
- Stop Bamboo server.
- Follow the guidelines inside the Configuring your system properties document to add the following JVM argument to Bamboo: -Djava.awt.headless=true
- Start Bamboo server.
Solution 2
Upgrade Java to the latest available version that is compatible with the current version of Bamboo you're running: Supported platforms and edit JAVA_HOME to look into the new JDK directory. A Bamboo restart is required for the changes to take effect.
Solution 3
Check if the libxtst6 library has been installed in the operating system where Bamboo is running using:
ldd /home/mytestone/opt/linux/oraclejdk/jdk1.7.0/jre/amd64/xawt/libmawt.so
If the library is missing, try installing it using the following command:
sudo apt-get install libxtst6