QualInsight / qualinsight-plugins-sonarqube-badges

Plugin for SonarQube that generates badges displaying information about a project's or view's quality.
GNU Lesser General Public License v3.0
110 stars 141 forks source link

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

Open ghost opened 8 years ago

ghost commented 8 years ago

enviroment to reproduce

docker run -d  --name sonarqube-develop \
        -p 9000:9000 \
        -p 9092:9092 \
        sonarqube:5.6-alpine

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
pawlakm commented 8 years ago

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.

petemounce commented 8 years ago

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

pawlakm commented 8 years ago

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)

steve-todorov commented 7 years ago

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

n2o commented 7 years ago

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

pawlakm commented 7 years ago

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.

Bazze commented 6 years ago

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