Was configuring a new server for our application. Checked out sources from SVN and started compiling them with Maven. One of the pom.xml files contains instructions which precompile report JRXML files into JASPER files by the means of jasperreports-maven-plugin plugin. I was greatly confused when saw something like this:Error compiling report design : /home/andy/Sources/trunk/service/src/main/resources/com/softteco/jasperreports/data.jrxml : Error compiling report java source files : /home/andy/Sources/trunk/service/target/jasperreports/java/TableOfContentsReport_1296471173962_463866.java Hm, lets try running maven with “-X -e” options to see more details. org.apache.maven.BuildFailureException: Error compiling report…

When you try to compile the report with the statement like<printWhenExpression><![CDATA[$F{billingData} != null]]></printWhenExpression>you’ll get the errors like:1. Cannot cast from boolean to BooleanThe reason is that by default compliance with very low JDK versions is used. Something like 1.2 or 1.3. So lets migrate compilation of JasperReports templates to Java 5. JasperReports uses Eclipse JDT compiler so we’ll need to specify the following parameters:org.eclipse.jdt.core.compiler.source=1.5org.eclipse.jdt.core.compiler.compliance=1.5org.eclipse.jdt.core.compiler.codegen.TargetPlatform=1.5You can do it via jasperreports.properties file/System.setProperty()/JVM parameters.Once you specify these parameters – all of the boxing/unboxing…

In our application we have a set of common colours which are used on the reports. These colours can be rather dynamic and are stored in the properties file. Once some chart is rendered – the colour is loaded from the file and the used to create chart. It’s rather trivial to do this for the chart. Just specify JRChartCustomizer and do everything you want.It’s not so trivial to change the background colour of the cells in the JasperReports crosstab….

Today I was returning to the old project after a long period of inactivity. So I’ve checked out the sources code from Subversion repository, built the project and deployed application to JBoss. And all of the JasperReports were failing. It’s important to mention that we precompile reports and use the compiled ones to generate reports. The exception sounded like:java.lang.NullPointerException at net.sf.jasperreports.engine.JRPropertiesMap.readObject(JRPropertiesMap.java:176)… I’ve tried to debug JasperReports but it didn’t make much sense. There were only several web sites in Chinese…

Displaying bar charts in the limited space usually truncates category labels and it makes the chart not readable in some cases: Not so beautiful, right? So lets fix this problem. The template format of JasperReports is a bit limited and does not allow to pass some required attributes to jfreechart directly. However for every chart you can specify your own customizer class …<barChart> <chart hyperlinkType=“None” customizerClass=“org.test.MyCustomizer”>… The main idea of the fix is to allow displaying bar chart labels in…

JasperReports can be used to provide reports in various formats like HTML, PDF and others based on a single XML template. You just need to call different exporters which get ReportPrint object and generate data in various formats. We have support of HTML, PDF, XLS, RTF and use version 3.0.1 of JasperReports in our application. Today we have found a problem with the RTF exporter. In some cases the font colors are invalid in the RTF reports. In our case…

I really like JasperReports, it’s cool.But sometimes it can ruin your mind when you’re trying to understand why this report looks like so weird. So today I was trying to generating Excel report and saw the following picture: What the hell? Where’s my data? I had to debug JasperReports to understand why it happens. Finally I’ve got down to JRGridLayout#isOverlap which calculates whether the item intersects with some other report items. If isOverlap returns true the text is not rendered….

JasperReports is an open-source java library to build reports. It tightly integrates with the JFreeChart to provide charts. For me, JasperReports is one of the best open source solutions I’ve ever used. It’s really customizable and configurable and you can do really fantastic things with it. While working for about a year with JasperReports, I’ve met several limitations and places which could be implemented better. So I plan to describe some solutions I’ve found here. The first thing I’ve mentioned…