Jump to content
Changes to the Jaspersoft community edition download ×

JRException:Can't read font file (*.ttf) on linux


anonymous_user

Recommended Posts

JRException Can't read font file (*.ttf) on linux

 

 

Hello everybody,

 

I have a problem with reading file font (ex: Arial.ttf) on linux server

I export the jasper report from my java code, and set a folder for fonts (arabic fonts) under fonts folder on my application

and my java code set PDF font of jasper report to refer to font under this path (ex: /xxx/fonts/Arial.ttf) and set PDFEncoding to be Identity-H to support Arabic and English letters

it works well for me on windows servers for both browsers (internet explorer and Mozilla firefox).

But on linux servers when calling report the page appears blank on firefox browser and i found the following exception:

net.sf.jasperreports.engine.JRException: Could not load the following font :

pdfFontName : /usr/local/tomcat/webapps/xxx/fonts/Arial.ttf

pdfEncoding : Identity-H

isPdfEmbedded : true

at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:1389)

at net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:1311)

at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:1631)

at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:559)

at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:523)

at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:488)

at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:271)

at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdf(JasperExportManager.java:188)

at com.company.presentation.Report.PrintReport(Report.java:130)

at com.company.presentation.Report.Print(Report.java:72)

at com.company.presentation.Report.TestAction.PrintUnique(TestAction.java:637)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:585)

at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)

at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)

at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)

at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)

at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)

at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at ma.fmcp.presentation.UTF8Filter.doFilter(UTF8Filter.java:28)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)

at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)

at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)

at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)

at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)

at java.lang.Thread.run(Thread.java:595)

 

 

 

Any help will be appreciated.

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

Now there is no exception appears now after i have changed the *.ttf to *.TTF as Linux is case sensative with finding files where windows is not, i discover that by chance from minutes.

 

But although of that, the report didn't displayed on linux because it throws another exception because i included an image on my report (logo image) and i set image expression to "http://www.upload2world.com/pic63/upload2world_487f0.jpg" from IReport.

 

But it seems that linux can't download image, and throws the following exception:

 

net.sf.jasperreports.engine.JRException: Error loading image data : http://www.upload2world.com/pic63/upload2world_487f0.jpg

at net.sf.jasperreports.engine.util.JRImageLoader.loadImageDataFromURL(JRImageLoader.java:108)

at net.sf.jasperreports.engine.util.JRImageLoader.loadImageDataFromLocation(JRImageLoader.java:151)

at net.sf.jasperreports.engine.JRImageRenderer.getInstance(JRImageRenderer.java:190)

at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:481)

at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:430)

at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:277)

at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:399)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:279)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:220)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:758)

at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:685)

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

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

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

 

and this exception didn't appear before.

Thanks lucianc for help.

Link to comment
Share on other sites

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...