qualinsight-plugins-sonarqube-badges icon indicating copy to clipboard operation
qualinsight-plugins-sonarqube-badges copied to clipboard

Cannot start SQ when installing SVG Badges plugin on Docker JRE 8 image

Open ghost opened this issue 9 years ago • 7 comments

enviroment to reproduce

  • start the latest docker container
docker run -d  --name sonarqube-develop \
        -p 9000:9000 \
        -p 9092:9092 \
        sonarqube:5.6-alpine
  • visit localhost:9000/updatecenter/available
  • click install SVG Badges (v2.01)
  • click restart sonarqube
  • run docker logs sonarqube-develop

and you will see this

2016.06.26 05:25:30 ERROR web[o.a.c.c.C.[.[.[/]] Exception sending context initialized event to listener instance of class org.sonar.server.platform.PlatformServletContextListener  
java.lang.IllegalStateException: Unable to load component class com.qualinsight.plugins.sonarqube.badges.ws.BadgesWebService                                                         
        at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:69) ~[sonar-core-5.6.jar:na]                                 

the stack trace is

java.lang.IllegalStateException: Unable to load component class com.qualinsight.plugins.sonarqube.badges.ws.BadgesWebService
Caused by: java.lang.IllegalStateException: Unable to load component class com.qualinsight.plugins.sonarqube.badges.ws.gate.QualityGateBadgeAction
Caused by: java.lang.IllegalStateException: Unable to load component class com.qualinsight.plugins.sonarqube.badges.ws.gate.QualityGateBadgeRequestHandler
Caused by: java.lang.IllegalStateException: Unable to load component class com.qualinsight.plugins.sonarqube.badges.ws.gate.QualityGateBadgeGenerator
Caused by: java.lang.IllegalStateException: Unable to load component class com.qualinsight.plugins.sonarqube.badges.ws.SVGImageGenerator
Caused by: java.lang.IllegalStateException: Unable to load component class com.qualinsight.plugins.sonarqube.badges.font.FontProviderLocator
Caused by: java.lang.NullPointerException: null
        at sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1264) ~[na:1.8.0_92-internal

ghost avatar Jun 26 '16 06:06 ghost

Hi,

font loading requires awt X11, which is missing from headless version of JRE. This problem is thus probably due to the fact that you're using openjdk-8-jre-headless. To fix it, simply install openjdk-8-jre instead and the problem will go away.

Tell me if this fixes your issue.

pawlakm avatar Jul 14 '16 19:07 pawlakm

If I use sonarqube:6.0-alpine, this plugin prevents the web process from starting up.

petemounce avatar Aug 11 '16 23:08 petemounce

It seems that this issue is on openjdk docker image side. A fix (workaround) has been committed 7 days ago. See https://github.com/docker-library/openjdk/issues/73

I don't really want to start catching NPEs because of an openjdk packaging issue, and calling 'GraphicsEnvironment.isHeadless()' won't help in this case (a NPE is thrown if no fonts are found and 'isHeadless()' does not check for font availability)

pawlakm avatar Aug 23 '16 08:08 pawlakm

It appears this is still an issue in sonarqube:6.2-alpine. After switching to sonarqube:6.2 everything worked without any problem.

steve-todorov avatar Mar 04 '17 06:03 steve-todorov

Having the same issue using sonarqube:6.3.1-alpine...

I removed qualinsight-sonarqube-badges-3.0.1.jar from my plugins folder and now sonarqube is again available

n2o avatar May 22 '17 08:05 n2o

Again, if you're facing the same issue, the problem is on openjdk packaging side. Please read above comments for more information / details how to fix it.

pawlakm avatar May 22 '17 21:05 pawlakm

For those of you that doesn't have the time to read the whole thread in https://github.com/docker-library/openjdk/issues/73: Installing the APK package ttf-dejavu seems to solve the issue.

In your Dockerfile it could look like this:

RUN apk add --no-cache --update ttf-dejavu

Bazze avatar Apr 03 '18 14:04 Bazze