Login into Bamboo fails due to broken Captcha image with FontConfiguration error
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
Summary
Bamboo chart gadgets throw Java Null Pointer Exceptions (NPE) or fail with FontConfiguration errors when installed on Linux operating systems with AdoptOpenJDK.
Environment
Bamboo 7 and later
Linux
Diagnosis
You will see the following error in the atlassian-bamboo.log
log file when users are trying to login into Bamboo:
1
2
3
4
5
6
7
2021-02-10 12:50:05,151 ERROR [http-nio-8080-exec-22] [FiveOhOh] 500 Exception was thrown.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'imageCaptchaService' defined in class path resource [applicationContextCaptcha.xml]: Cannot resolve reference to bean 'captchaEngine' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'captchaEngine' defined in class path resource [applicationContextCaptcha.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.octo.captcha.engine.image.gimpy.DefaultGimpyEngine]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:314)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolve
18:25:49 From skale to Everyone : from server
18:26:46 From skale to Everyone : Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'captchaEngine' defined in class path resource [applicationContextCaptcha.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.octo.captcha.engine.image.gimpy.DefaultGimpyEngine]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1302)
Cause
AdoptOpenJDK does not include a font configuration package, required by the Bamboo captcha feature.
Solution
It is important to check the atlassian-bamboo.log
file for the Java Null Pointer Exception below, then first try the solution outlined in Captcha not showing after a couple of failed attempts:
1
2
3
4
5
6
7
8
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.octo.captcha.engine.image.gimpy.DefaultGimpyEngine]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:184)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1294)
... 192 more
Caused by: java.lang.NullPointerException
at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264)
at sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:219)
The reason why you need to disable the captcha as mentioned in the document is that by doing so the end-users will be able to log in again without issues. However for security reasons, if you do not want to disable the captcha, then to solve this problem, install fontconfig (or an equivalent), and then restart Bamboo. Refer to the documentation for your Linux distribution or preferred package manager for information on how to do this.
Here are the commands to install font dependency in a number of common Linux distributions and package managers. Your mileage will vary.
Ubuntu
1
sudo apt install -y fontconfig
CentOS
CentOS 7 does not work with fontconfig. You can install dejavu-sans-fonts as an alternative:
1
sudo yum install -y dejavu-sans-fonts
RHEL
1
sudo yum install fontconfig
On RHEL 6, it might be necessary to install both the dejavu-sans-fonts and the fontconfig packages:
1
sudo yum install fontconfig dejavu-sans-fonts
Debian
1
apt-get update && apt-get install -y fontconfig
Fedora
1
dnf install -y fontconfig
Once you finish the fontconfig or equivalent installation, please restart Bamboo.
Was this helpful?