net.sf.jasperreports.engine.JRRuntimeException: ja

2019-05-28 22:13发布

问题:

I am trying to create PDF report via JasperReport but there is a broblem to reading font data. I have jasperreports_extension.properties & the relevant TTF files in ClassPath. here is the error:

java.io.IOException: Problem reading font data.
    java.awt.Font.createFont(Font.java:924)
    net.sf.jasperreports.engine.fonts.SimpleFontFace.<init>(SimpleFontFace.java:69)
    net.sf.jasperreports.engine.fonts.SimpleFontFamily.createFontFace(SimpleFontFamily.java:316)
    net.sf.jasperreports.engine.fonts.SimpleFontFamily.setNormal(SimpleFontFamily.java:85)
    net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.parseFontFamily(SimpleFontExtensionHelper.java:243)
    net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.parseFontFamilies(SimpleFontExtensionHelper.java:214)
    net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:183)
    net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:152)
    net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.getExtensions(FontExtensionsRegistry.java:55)
    net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensions(DefaultExtensionsRegistry.java:110)
    net.sf.jasperreports.engine.util.JRStyledTextParser.<clinit>(JRStyledTextParser.java:83)
    net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:121)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:87)
    net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:57)
    net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:142)
    net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:78)
    net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
    org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.fillReport(AbstractJasperReportsView.java:666)
    org.springframework.web.servlet.view.jasperreports.AbstractJasperReportsView.renderMergedOutputModel(AbstractJasperReportsView.java:559)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1063)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:801)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

who can help me with it??

thanks!

回答1:

Change permissions on the tomcat temp directory to allow tomcat/jasper to write to it.

See: http://community.jaspersoft.com/questions/543492/javaioioexception-problem-reading-font-data



回答2:

In My case I solved this issues by manually creating a temp directory in Tomcat folder and changing permission.

Running tomcat/application server with administrator access can also help.



回答3:

I am facing the same issue and root cause in my case is temp folder is removed from tomcat directory solution is when i created temp folder in tomcat then this issue is resolved.