bblagus Posted March 21, 2019 Share Posted March 21, 2019 I am a java program developer and using your Jasperreports products. Until recently I was using iReport 4.5.1, but now I decided to migrate my reports to Jasperreports 6. 5.1 So, using the Jasperstudio 6.5.1 I migrated some of my reports to the Version 6.5.1. My web applications are runnig on the Tomcat Server version 8.5. My question is: is it possible to run on the same web server jasperreports 4.1.1 and jasperreports 6.5.1? I have noticed that if I start report using jasperreports 6.5.1 after starting tomcat server as the very first program, then it is not possible to run the reports using jasperreports 4.1.1 any more. The error i get is:net.sf.jasperreports.engine.JRRuntimeException: Could not load the following font: pdfFontName: Helvetica pdfEncoding: Identity-H isPdfEmbedded: false at net.sf.jasperreports.engine.export.JRPdfExporter.getFont(JRPdfExporter.java:2340)at net.sf.jasperreports.engine.export.JRPdfExporter.getChunk(JRPdfExporter.java:2123)at net.sf.jasperreports.engine.export.JRPdfExporter.getPhrase(JRPdfExporter.java:2092)at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.getPhrase(SimplePdfTextRenderer.java:64)at net.sf.jasperreports.engine.export.SimplePdfTextRenderer.render(SimplePdfTextRenderer.java:73)at net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:2453)at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:1109)at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:1068)at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:932)at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:552)at net.sf.jasperreports.engine.JasperExportManager.exportToPdfStream(JasperExportManager.java:196)at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(JasperExportManager.java:533)[/code]The other reports that are using Jasperreports 6.5.1 are working fine.All librariers (jar files) for Jasperreports 4 are in the "share" folder of Tomcat server.The libraries for Jasperreports 6 are in application's war file.Do you have any advice? Best regards Branka Blagus Link to comment Share on other sites More sharing options...
C-Box Posted March 21, 2019 Share Posted March 21, 2019 It's not a good idea to have different versions of JasperReports within one application. So actually your old reports should also run with latest version of JasperReports. So the designs made with JR 4.1.1 should also run with JR 6.5.1 - at least this was my experience when upgrading JR in the last years.The error you posted is because one of your designs needs the Helvetica font embedded in the PDF but you don't have a corresponding fontextension within your classpath. When I remember right, in former versions of JR the helvetica font was kind of "built-in"... but later the whole font handling was redesigned and font-extensions became necessary . So try to analyse why the font error appears .. (or just create a font extension for helvetica and put that jar also in your classpath) and remove the old JR 4.1.1 libraries from your project.hth + regardsC-Box Link to comment Share on other sites More sharing options...
bblagus Posted March 21, 2019 Author Share Posted March 21, 2019 Thank you for the prompt answer. So, just to explain the situation. The applications with Jasper 4 and Jasper 6 are two different applications. The problem (error) comes only on Tomcat server running on Linux. On Windows (my locale Tomcat server) everything is OK. So, when I start as the very first application after Tomcat server restarting (Linux server) , the application that uses Jasper 4, everything is OK. There is no error at all. Jasper 4 and Jasper 6 work fine. The problem appears when the very first application uses Jasper 6. Then all Jasper 4 applications that have "isPdfEmbedded=true" end in error. I have many Jasper 4 reports. I plan to migrate them to Jasper 6, but I can't do it all at once.Example from Jasper 4 that causes an error:<font fontName="Courier New" isBold="true" pdfFontName="" pdfEncoding="Identity-H" isPdfEmbedded="true"/> In Jasper 6 I changed it to:<font fontName="CourierIS" isBold="true"/>where CourierIS is my own font added to jasperreports-fonts.jar So, I will be grateful for the new ideas. regards Branka Link to comment Share on other sites More sharing options...
Friendly User Posted March 21, 2019 Share Posted March 21, 2019 Seems that there is no Helvetica font available to your JVM. I would suggest you to package the Courier font into a font extension JAR and add it to the application's classpath. If you don't have Courier font available to JVM then it'll try to use something else to embed into the PDF and that is Helvetica and it can't do it.I would also suggest to not deploy JR Lib of different versions to same tomcat as it might cause weird classloading issues unless you are pretty sure that you can isolate the classloading. I'd suggest to host two tomcats and have one run the JRLib 4 app, the other run JRLib 6 app. Link to comment Share on other sites More sharing options...
bblagus Posted March 22, 2019 Author Share Posted March 22, 2019 Thx! I already have my courier.jar as the library for Jasper 4, but it doesn't help. It seems that the only reliable solution is that with two tomcats. Link to comment Share on other sites More sharing options...
hozawa Posted March 23, 2019 Share Posted March 23, 2019 Try putting jasperreports.jar under the lib in your application war directory instead of under the tomcat lib directory. Link to comment Share on other sites More sharing options...
bblagus Posted March 25, 2019 Author Share Posted March 25, 2019 Greetings hozawa,unfortunately there is no way to change the old JR 4 applications, and JR 6 application has jasperreport.jar in war.The plan is to upgrade all of them to JR 6, and I try to find some solution to do this upgrading in phases.regards, bblagus Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now