Captcha image not visible
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
The captcha image is not loaded and the following stack trace can be seen in the atlassian-stash.log
:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
2014-12-15 09:41:56,029 ERROR [http-bio-7990-exec-14] @12Q0SCVx581x330x2 1r0vx13 XX.XX.XX.XX,0:0:0:0:0:0:0:1 "GET /captcha HTTP/1.1" c.a.s.i.w.HandlerExceptionResolverImpl Error creating bean with name 'imageCaptchaServicePrototype' defined in class path resource [stash-context.xml]: Cannot create inner bean 'com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine#4ff29711' of type [com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine#4ff29711' defined in class path resource [stash-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine]: Constructor threw exception; nested exception is java.lang.NullPointerException
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'imageCaptchaServicePrototype' defined in class path resource [stash-context.xml]: Cannot create inner bean 'com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine#4ff29711' of type [com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine#4ff29711' defined in class path resource [stash-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:290) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
at com.atlassian.stash.internal.web.users.CaptchaController.viewCaptcha(CaptchaController.java:29) ~[CaptchaController.class:na]
at com.atlassian.applinks.core.rest.context.ContextFilter.doFilter(ContextFilter.java:25) [applinks-plugin-4.2.2_1402956146000.jar:na]
at com.atlassian.stash.internal.spring.security.StashAuthenticationFilter.doFilter(StashAuthenticationFilter.java:111) [StashAuthenticationFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:111) [BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:77) [BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:100) [atlassian-trusted-apps-core-3.0.6.jar:na]
at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:69) [atlassian-oauth-service-provider-plugin-1.9.2_1399475174000.jar:na]
at com.hazelcast.web.WebFilter$RequestWrapper$1.forward(WebFilter.java:525) [hazelcast-wm-3.3-RC2.jar:3.3-RC2]
at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationsFilter.doFilter(TrustedApplicationsFilter.java:100) [atlassian-trusted-apps-core-3.0.6.jar:na]
at com.atlassian.oauth.serviceprovider.internal.servlet.OAuthFilter.doFilter(OAuthFilter.java:69) [atlassian-oauth-service-provider-plugin-1.9.2_1399475174000.jar:na]
at com.atlassian.analytics.client.filter.DefaultAnalyticsFilter.doFilter(DefaultAnalyticsFilter.java:33) [analytics-client-3.35_1406650100000.jar:na]
at com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31) [atlassian-core-4.6.15.jar:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:89) [BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.stash.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75) [BeforeLoginPluginAuthenticationFilter.class:na]
at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:84) [stash-service-impl-3.2.2.jar:na]
at com.hazelcast.web.WebFilter.doFilter(WebFilter.java:446) [hazelcast-wm-3.3-RC2.jar:3.3-RC2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [na:1.7.0_03-icedtea]
at java.lang.Thread.run(Thread.java:722) [na:1.7.0_03-icedtea]
... 240 frames trimmed
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine#4ff29711' defined in class path resource [stash-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1076) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
... 19 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine]: Constructor threw exception; nested exception is java.lang.NullPointerException
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:164) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
... 19 common frames omitted
Caused by: java.lang.NullPointerException: null
at sun.awt.X11FontManager.getDefaultPlatformFont(X11FontManager.java:779) ~[na:1.7.0_03-icedtea]
at sun.font.SunFontManager$2.run(SunFontManager.java:428) ~[na:1.7.0_03-icedtea]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_03-icedtea]
at sun.font.SunFontManager.<init>(SunFontManager.java:371) ~[na:1.7.0_03-icedtea]
at sun.awt.X11FontManager.<init>(X11FontManager.java:32) ~[na:1.7.0_03-icedtea]
at java.lang.Class.newInstance0(Class.java:372) ~[na:1.7.0_03-icedtea]
at java.lang.Class.newInstance(Class.java:325) ~[na:1.7.0_03-icedtea]
at sun.font.FontManagerFactory$1.run(FontManagerFactory.java:80) ~[na:1.7.0_03-icedtea]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_03-icedtea]
at sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:71) ~[na:1.7.0_03-icedtea]
at java.awt.Font.getFont2D(Font.java:489) ~[na:1.7.0_03-icedtea]
at java.awt.Font.canDisplay(Font.java:1946) ~[na:1.7.0_03-icedtea]
at com.octo.captcha.component.image.fontgenerator.RandomFontGenerator.checkFontCanDisplayCharacters(RandomFontGenerator.java:223) ~[jcaptcha-2.0-alpha-1.jar:na]
at com.octo.captcha.component.image.fontgenerator.RandomFontGenerator.cleanFontList(RandomFontGenerator.java:179) ~[jcaptcha-2.0-alpha-1.jar:na]
at com.octo.captcha.component.image.fontgenerator.RandomFontGenerator.initializeFonts(RandomFontGenerator.java:94) ~[jcaptcha-2.0-alpha-1.jar:na]
at com.octo.captcha.component.image.fontgenerator.RandomFontGenerator.<init>(RandomFontGenerator.java:81) ~[jcaptcha-2.0-alpha-1.jar:na]
at com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine.buildInitialFactories(StashCaptchaEngine.java:46) ~[StashCaptchaEngine.class:na]
at com.octo.captcha.engine.image.ListImageCaptchaEngine.<init>(ListImageCaptchaEngine.java:24) ~[jcaptcha-2.0-alpha-1.jar:na]
at com.atlassian.stash.internal.web.util.captcha.StashCaptchaEngine.<init>(StashCaptchaEngine.java:29) ~[StashCaptchaEngine.class:na]
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148) ~[spring-beans-4.0.5.RELEASE.jar:4.0.5.RELEASE]
... 19 common frames omitted
Cause
This is caused because of missing fonts, due to which the application cannot perform graphics rendering. Although we support OpenJDK it's likely that this issue was caused because, the package manager used to install Java didn't install "Java fonts".
Resolution
Install the JDK Fonts package on top of the Oracle JDK by running:
1
sudo apt-get install deja*
Restart Stash.
Check the Supported platforms page to ensure a compatible environment.
Was this helpful?