Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser

前端 未结 19 2129
清酒与你
清酒与你 2020-12-10 01:32

I\'m trying to display my reports on the browser , but I keep getting this error:

\"enter

相关标签:
19条回答
  • 2020-12-10 01:51

    There are 2 steps to solve this problem.

    1. -Djaav.awt.headless=true in startup script or vm options

    2. Install the fonts

      yum install fontconfig

    Then you can verify

    rpm -qa | grep font
    fontpackages-filesystem-1.44-8.el7.noarch
    dejavu-fonts-common-2.33-6.el7.noarch
    fontconfig-2.13.0-4.3.el7.x86_64
    dejavu-sans-fonts-2.33-6.el7.noarch
    

    This is on CentOS 7. We had been using Google Noto fonts and thought that we do not need any font installation but was wrong.

    0 讨论(0)
  • 2020-12-10 01:54

    I've faced the same issue on my development machine. Basically it was happened due to problem in application server (Apache tomcat)

    Basically I've accidentally deleted the "temp" folder in server root. So jasper cant compile the report and proceed with the report generation.

    0 讨论(0)
  • 2020-12-10 01:55

    this may be problems with memory, reboot the server.

    0 讨论(0)
  • 2020-12-10 01:56

    I got this error while deploying springboot app (including jasper reporting) in docker container.The problem was with openjdk:8-jdk-alpine which I used for building docker container environment. That has a bug in fonts support. Therefore I switched to openjdk:8-jre (or OpenJDK 7 versions will also help) and it worked for me. I spent days to fix this bug.

    0 讨论(0)
  • 2020-12-10 01:57

    In our case it helped to delete the temp server (thus making sure there are no jar duplicities) and restart server. Hint: try this in case if the error starts occurring after a new release (but worked before and nothing relevant changed in the release)

    0 讨论(0)
  • 2020-12-10 01:58

    For me the issue was regarding a bug in AdoptOpenJDK: https://github.com/AdoptOpenJDK/openjdk-build/issues/682

    I fixed the issue by installing ttf-dejavu manually in my dockerfile

    FROM adoptopenjdk/openjdk8:alpine-jre
    
    # Workaround for wrong font configuration in adoptopenjdk
    # https://github.com/AdoptOpenJDK/openjdk-build/issues/682
    RUN apk update && apk upgrade \
       && apk add --no-cache ttf-dejavu \
       # Install windows fonts as well. Not required..
       && apk add --no-cache msttcorefonts-installer \
       && update-ms-fonts && fc-cache -f
    

    AND by running the application with the flag -Djava.awt.headless=true

    0 讨论(0)
提交回复
热议问题