Jump to content
We've recently updated our Privacy Statement, available here ×

java.io.IOException: Problem reading font data


vishalmestri

Recommended Posts

 I am using jboss application server.

Jasper version - 4.5

JDK - 1.6

Created a report and deployed on jboss running on linux.

We are using Arial font , hence we created extension jar and included in WEB-IN/lib folder.

 


Now we are getting issue-

 

java.io.IOException: Problem reading font data.

at java.awt.Font.createFont(Font.java:924)

at net.sf.jasperreports.engine.fonts.SimpleFontFace.<init>(SimpleFontFace.java:69)

at net.sf.jasperreports.engine.fonts.SimpleFontFamily.createFontFace(SimpleFontFamily.java:316)

at net.sf.jasperreports.engine.fonts.SimpleFontFamily.setNormal(SimpleFontFamily.java:85)

at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.parseFontFamily(SimpleFontExtensionHelper.java:243)

at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.parseFontFamilies(SimpleFontExtensionHelper.java:214)

at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:183)

at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontFamilies(SimpleFontExtensionHelper.java:152)

at net.sf.jasperreports.engine.fonts.FontExtensionsRegistry.getExtensions(FontExtensionsRegistry.java:55)

at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensions(DefaultExtensionsRegistry.java:110)

at net.sf.jasperreports.engine.util.JRStyledTextParser.<clinit>(JRStyledTextParser.java:83)

at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:121)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:87)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:57)

at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:142)

at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:52)

at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)

 

 


 

I can not share jrxml file due to privacy issue.

But the what i did put arial font ttf file in JDK/jre/lib/fonts/ folder.

And wrote core java prog and it is running successfully.

But when I run through JBOSS it is giving above mentioend issue.

 

Kindly help its urgent.



Post Edited by vishalmestri at 07/27/2012 05:54
Link to comment
Share on other sites

  • 2 months later...
  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

I exactly had the same behavour and after playing around with fonts and font-extensions I ended up with building my own jasperreports-jar for digging purposes:

I discovered that the errormessage was completely misleading and that the root cause originated from java.awt.Front not beeing able to write the Java-temp-directory (java.io.tmpdir). In my case this was the temp-directory of the tomcat-installation.

After having changed the permissions of the tomcat-temp-directory everything ran like expected.

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...
  • 4 weeks later...
  • 1 year later...
Oh God, you saved my day! I have been trying to figure out this since yesterday. That `java.awt.headless=true` property didn't work for me. It was working fine on my local dev machine, but not working on the qa server. All I had to do is to create the Tomcat temp folder manually and it worked like a charm. I have been searching about this online since yesterday and I feel really lucky to find this answer. Thanks again! +1
Link to comment
Share on other sites

  • 3 weeks later...
  • 1 year later...

If you're using SYS V init scripts and running in a container such a Tomcat, DON'T start the script directly with:

    sudo /etc/init.d/tomcat7 start

That will start it without a clean environment.

Instead, use the service command:

    sudo /sbin/service tomcat7 start

Link to comment
Share on other sites

  • 1 year later...
  • 1 year later...

In my particular case, after I had upgraded Ubuntu 18.04 server version, the reported issue started to happen. The font was already present on the Ubuntu Server.   I had to run fc-cache -f -v to clear the font cache. however, I had to first apt install fontconfig  and then run c-cache -f -v to resolve the issue.

Link to comment
Share on other sites

  • 2 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...