Jump to content
JasperReports Library 7.0 is now available ×

JasperFillManager.fillReport not working on CentOS 7.3


longdh101092

Recommended Posts

Hi Everybody!

Sorry for my bad English :(

I have a trouble with JasperFillManager.fillReport on Java 8 and CentOS 7.3.I want to create a PDF file with JasperReport 6.6.0 library. In windows 10, it's working normaly but when I upload my program to server (CentOS 7.3) it's doesn't work, I'm cheked server's log but this don't have any exeption or any bug. I use Japanese for text of PDF file.

Here's environment of my program:

・JAVA  8
・TOMCAT  8.5
・iText  5.5
・Jasperreports  6.6

I think may be problem is Centos 7.3 not have font for Japanese but it's wrong (I tried to fix it with blank PDF file and not work too). After that, I check authority of file.jasper and file.jrxml and it's ok. Finnally, I try to debug step by step and my code die from JasperFillManager.fillReport.

Here's my code (sorry I can't show all of code):

JasperReport report = JasperCompileManager.compileReport("path_of_jrxml_file.jrxml");
JasperPrint jrpint_jpn = JasperFillManager.fillReport(report, parameter, new JREmptyDataSource());

parameter is Map<String, Object> and it have values

Could you tell me what's my problem or some method to check cause or how to fix it on CentOS.

I hope you understand me, and I'm sorry again for my English.

Thanks.

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Are you sure, that iText 5.5 is working with JasperReports 6.6.0 ?? As far as I know, Jasper just uses the old (L)GPL library of iText 2.1.7 ... (e.g. in Studio also just "itext_2.1.7.js6_b02.jar" is included in classpath) as the later library version of itext was another - not free - licence type. Or do you own an iText licence for 5.5 ?

So another try would be to change the log4j-level to TRACE 

hth + regards

C-Box

 

Link to comment
Share on other sites

You can stay at JasperReports 6.6.0 so no downgrade needed.... just use the itext-library that is included in JR-distribution (as they changed some stuff for their needs ... that's why the included jar-file has the suffix "js6_b02" in the filename). 

 

hth + regards

C-Box

Link to comment
Share on other sites

Hi C-Box

I tried to downgrade itext version to 2.1.7 and it's not work on CentOS but work on Windows. I don't know why but when I view it's log result of JasperFillManager.fillReport is null. Here's my code and log, can you help me?

Code:

JasperReport report = null;
JasperPrint jrprint_jpn = null;
try {
report = JasperCompileManager.compileReport("path_of_jrxml_file.jrxml");
this.logger.info("【jasperReport.getName()】" + report.getName());
jrpint_jpn = JasperFillManager.fillReport(report, parameter, new JREmptyDataSource());
this.logger.info("【JasperPrint.getName()】:" + jrpint_jpn.getName());
} catch (JRExeption e){
this.logger.info("JRExeption has error");
this.logger.error(e);
} finally {
if (report == null) {
this.logger.debug("JasperReport class not work!")
}
if (jrpint_jpn == null) {
this.logger.debug("JasperPrint class not work!")
}
File fl = new File("file_path");
if (!fl.exists()){
this.logger.error("PDF file is not found!");
return false;
}
this.logger.info("PDF file is found!");
}

Log on CentOS

【jasperReport.getName()】Report01
created delayed action 1 for filler 1
Loading font extensions from font/font.xml
Parsing font familu ipaexg
Loading font font/ipaexg.ttf
Loading font extensions from net/sf/jasperreports/fonts/fonts.xml
Parsing font family DejaVu Sans
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSans.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSans-Bold.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSans-Oblique.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSans-BoldOblique.ttf
Parsing font family DejaVu Serif
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSerif.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSerif-Bold.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSerif-Oblique.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSerif-BoldOblique.ttf
Parsing font family DejaVu Sans Mono
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSansMono.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSansMono-Bold.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSansMono-Oblique.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf
Parsing font family SansSerif
Parsing font family Serif
Parsing font family Monospaced
Parsing font family JasperReports Icons
Loading font net/sf/jasperreport/fonts/icons/icons.ttf
Parsing font family Pictonic
Loading font net/sf/jasperreport/fonts/icons/icons.ttf
JasperPrint class not work!
PDF file is found!
 

Log on Windows

【jasperReport.getName()】Report01
created delayed action 1 for filler 1
Loading font extensions from font/font.xml
Parsing font familu ipaexg
Loading font font/ipaexg.ttf
Loading font extensions from net/sf/jasperreports/fonts/fonts.xml
Parsing font family DejaVu Sans
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSans.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSans-Bold.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSans-Oblique.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSans-BoldOblique.ttf
Parsing font family DejaVu Serif
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSerif.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSerif-Bold.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSerif-Oblique.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSerif-BoldOblique.ttf
Parsing font family DejaVu Sans Mono
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSansMono.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSansMono-Bold.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSansMono-Oblique.ttf
Loading font net/sf/jasperreport/fonts/dejavu/DejaVuSansMono-BoldOblique.ttf
Parsing font family SansSerif
Parsing font family Serif
Parsing font family Monospaced
Origin {reportName: null, groupName: null,bandType: TITLE} for band 1177750837
Origin {reportName: null, groupName: null,bandType: DETAIL} for band 1340861289
Filler 1 - pageHeight: 842, columnFooterOffsetY: 822, lastPageColumnFooterOffsetY: 822
Fill 1: filling report
max page width is 2097152000
Fill 1: adding page 1
Fill 1: title at 20
......
Fill 1: ended
【JasperPrint.getName()】: Report01
PDF file is found!
 

Please, help me!

Thanks and Regards

Link to comment
Share on other sites

Seems, as would cause the included Pictonic.ttf  (that is included in default jasperreports-6.6.0.jar) that problem.

I'm not familiar with CentOS, so I don't know, how the font-logic is working there. You could edit the jaspereports-fonts.xml in "jasperreports-6.6.0.jarnetsfjasperreportsfonts" and simply remove the entries for the Pictonic font. But not sure, if this is the correct solution.

Also you could throw an eye on this page: https://vorozco.com/blog/2018/2018-03-14-Empty-Reports-Jasper-Reports.html   or even this https://community.jaspersoft.com/questions/515250/solution-linux-pdf-font-problem

Perhaps you will have to fix the Fonts at your CentOS as well before using JasperReports generally?!?!

so sorry, no more glues from my side.

hth + regards

C-Box

Link to comment
Share on other sites

Well, this was just a try.... I know that this is a "built-in" config... but anyway no problem.

You can open the (orignal) "JasperReports-6.6.0.jar" of your classpath with any ZipProgram of your choice... (I use 7zip for that) and just navigate to the mentioned xml-file, open it with an editor of your choice, change it (e.g. remove the lines pointing to the icon font) and save the (temporarily extracted) xml... 7zip just ask's you, to replace the (temporary) changed file also in the (jar)archive, just confirm it.

Now you changed the "original" JasperReports-library.... but as this is just a try for tracking down the font problem, it's no problem. You easily can revert it (make a Backup before or download it again) Don't forget to restart your app, as you changed the library in your classpath.

regards again

C-Box

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