Thursday, August 26, 2021

JasperReports Server Mondrian OLAP - Parent Child Hierarchy Errors

Right from JasperReports Server version 5.6 to the current one (7.8 at the time of posting) there has been a persistent error when trying to navigate through OLAP cube settings or when drilling down on cubes that have parent child hierarchies present in dimensions.

This error is due to ji-jpivot using getSchemaReader() calls instead of getSchemaReader().withLocus() calls as required by newer Mondrian code and thus results in a java.util.EmptyStackException error.

Some of issues raised in this regard are 

https://community.jaspersoft.com/jasperreports-server/issues/3694

https://community.jaspersoft.com/questions/841162/emptystackexception-olap-analysis-after-update-jasperserver-56

One of our Consultants has also raised this issue in the forum 

https://community.jaspersoft.com/jasperreports-server/issues/4005

With helpful tips from some of the others on the forum, he was able to develop a patch and workaround for this issue. The relevant mondrian jar file needs to be replaced with the following patched one https://maplein.com/downloads/mondrian-3.6.7-JS-vfs1-1.jar

If using tomcat, the file is found in the WEB-INF/lib directory within the jasperserver tomcat webapps folder. Stop the application server service (tomcat, glassfish etc), replace mondrian jar file with the patched one downloaded and restart the service. Patched file should be renamed as required; for example in the 5.6.2 version file name is mondrian-3.6.4-JS-2.jar 

An important thing to note if using WinSCP to copy the file over for linux servers is that transfer settings should be set as Binary else file will be corrupted.