Java – Could not load the following font

fontshtmlireportjasper-reportsjava

I have a problem that have been already asked, but there are some specific differences in my case.

I'm supporting a web application (EJB 2, PostgreSQL 9.2.4, running on a JBoss 4.2.3) that have an issue.
Sometimes, when we try to generate a specific report, we get this error:

javax.servlet.ServletException: net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font : 
pdfFontName   : DejaVu Sans
pdfEncoding   : Cp1252
isPdfEmbedded : false
org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
stirq.scan.util.NoCacheFilter.doFilter(NoCacheFilter.java:38)
jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:118)
stirq.scan.util.TimeoutFilter.doFilter(TimeoutFilter.java:57)
stirq.scan.util.SecurityFilter.doFilter(SecurityFilter.java:82)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

I searched in many sites.
http://community.jaspersoft.com/questions/525505/could-not-load-following-font

Could not load the following font issue in iReport

JasperReports – font extensions does not work – can't find font while exporting to PDF

(And others)

As suggested in many answers, I am using font extension jar but still got the issue.

There are two fields of a table in the application's database that can contains html code.
I found that the bug occurs when there is a "font" tag in one of those two fields or the two.
Even if the specified font in this "font" tag is Arial the message I got is still concerning the font DejaVu Sans.

Every textfield of all my jrxml files are in font DejaVu Sans.
When I tested the preview mode of my report in IReport 4.1.1 every thing was fine.

I deleted every "font" tags of the two database fields containing HTML code for an occurrence that got the issue and it worked.

But the application is in production.
As you can see I can't delete every "font" tags in the database.

Any help would be appreciated.

Thanks.

Best Answer

In iReport if you set up a repository for your JasperServer you will be able to get the effective production version of a report xml into iReport. Then you can edit your file and replace by the edited version production one.