Captcha image doesn't render

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

症状

The captcha image is not loaded and the following stack trace can be seen in the atlassian-bitbucket.log:

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 [bitbucket-context.xml]: Cannot create inner bean 'com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine#4ff29711' of type [com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine#4ff29711' defined in class path resource [bitbucket-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine]: 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 [bitbucket-context.xml]: Cannot create inner bean 'com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine#4ff29711' of type [com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine#4ff29711' defined in class path resource [bitbucket-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine]: 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.bitbucket.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.bitbucket.internal.spring.security.Bitbucket ServerAuthenticationFilter.doFilter(Bitbucket ServerAuthenticationFilter.java:111) [Bitbucket ServerAuthenticationFilter.class:na]
	at com.atlassian.bitbucket.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doInsideSpringSecurityChain(BeforeLoginPluginAuthenticationFilter.java:111) [BeforeLoginPluginAuthenticationFilter.class:na]
	at com.atlassian.bitbucket.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.bitbucket.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doBeforeBeforeLoginFilters(BeforeLoginPluginAuthenticationFilter.java:89) [BeforeLoginPluginAuthenticationFilter.class:na]
	at com.atlassian.bitbucket.internal.web.auth.BeforeLoginPluginAuthenticationFilter.doFilter(BeforeLoginPluginAuthenticationFilter.java:75) [BeforeLoginPluginAuthenticationFilter.class:na]
	at com.atlassian.bitbucket.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:84) [bitbucket-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.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine#4ff29711' defined in class path resource [bitbucket-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine]: 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.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine]: 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.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine.buildInitialFactories(Bitbucket ServerCaptchaEngine.java:46) ~[Bitbucket ServerCaptchaEngine.class:na]
	at com.octo.captcha.engine.image.ListImageCaptchaEngine.<init>(ListImageCaptchaEngine.java:24) ~[jcaptcha-2.0-alpha-1.jar:na]
	at com.atlassian.bitbucket.internal.web.util.captcha.Bitbucket ServerCaptchaEngine.<init>(Bitbucket ServerCaptchaEngine.java:29) ~[Bitbucket ServerCaptchaEngine.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

原因

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".

ソリューション

Ubuntu/Debian:

  1. Install the JDK Fonts package on top of the Oracle JDK by running:

    sudo apt-get install fonts-dejavu-core
  2. Bitbucket Server を再起動します。

CentOS:

  1. Install the JDK Fonts package on top of the Oracle JDK by running:

    sudo yum install \
    dejavu-lgc-sans-fonts \
    dejavu-lgc-sans-mono-fonts \
    dejavu-lgc-serif-fonts \
    dejavu-sans-fonts \
    dejavu-sans-mono-fonts \
    dejavu-serif-fonts

    ( (warning) Note: you may consider adding also fontconfig package if it was not installed automatically after running the last command).

2. Restart Bitbucket Server.


Check the Supported platforms page to ensure a compatible environment.

最終更新日 2019 年 9 月 4 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.