java.lang.NoSuchMethodError: net.sf.jasperreports.engine.JROrigin.getBandType

Hi all,
we have a Jasper report with 2 nested subreports. It is compiled using iReport 4.0.2.
When we try to render it as a XLS, using Aspose.Words, we have no problems. When we try to render it as DOCX or ODT, the exception reported in the subject is thrown.
The meaningful part of the stack trace, starting from our exporter class, is the following:

java.lang.NoSuchMethodError: net.sf.jasperreports.engine.JROrigin.getBandType() B

com.aspose.words.jasperreports.l.Bl(Unknown Source)

com.aspose.words.jasperreports.a.a.j.a(Unknown Source)

com.aspose.words.jasperreports.a.a.h.a(Unknown Source)

com.aspose.words.jasperreports.a.a.h.a(Unknown Source)

com.aspose.words.jasperreports.AWAbstractExporter.a(Unknown Source)

com.aspose.words.jasperreports.AWAbstractExporter.exportReport(Unknown Source)

it.finmatica.reporting.beans.Export.exportReport(Export.java: 145)

it.finmatica.reporting.beans.Export.exportReportOdt(Export.java: 100)

I guess that the Aspose exporter tries to invoke a method which is no longer supported in the JasperReports version we are using (in fatct, according to the APIs, the method starts to be deprecated from the version 3.7.5 on, and definitely dropped since version 4.x).
So the questions are:

  1. when a new release of Aspose.Words, supporting JasperReports 4 ora later- will be released?
  2. is there a workaround to avoid the exception above? we can’t figure out where the JROrigin object is invoked by the Aspose exporter.

Thank you in advance
Maurizio

Hi Maurizio,

Thanks for your query. Please accept my apologies for late response. It would be great, If you share your jrxml files along with data source.

Hi Tahir,
we are trying to investigate the problem furhter, because we suspect that the recursion in one of the subreport could be the thing that messes up the whole report.
Moreover, we have some problem to generate a JRXMLDataSource, because the report reads data from database.
If we end up determining where is the problem, we’ll keep you informed.

Thank you
Maurizio

Hi Maurizio,

Thanks for sharing the information. Please let us know, If you find any issue related to Aspose.Words.

Hi Tahir,
we would like to share our jrxml with you, but it reads data from a database table, so it’s a bit difficult for us to produce a datasource.
We can export the table in many different formats or, if you want, we may modify the report to read data from an xml source.
Tell us what’s your favourite way to reproduce the problem.

Thank you
Maurizio

Hi Maurizio,

Thanks for sharing the information. It would be great, If you share your jrxml files along with data source as XML.

Hi Tahir,
here you’ll find the .jrxml and the xml datasource to generate the report.
I post the java code we use to export the report in odt format.

Map params = new HashMap();
JRAbstractExporter exporter = (JRAbstractExporter) Class.forName("com.aspose.words.jasperreports.AWOdtExporter").newInstance();
JRDataSource datasource = new JRXmlDataSource(new FileInputStream("/home/mlippa/dataSource.xml"));
JasperPrint print = JasperFillManager.fillReport("/home/mlippa/report_test.jasper", params, datasource);
exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "/home/mlippa/report_test.odt");
exporter.exportReport();

Please let us know your findings.
best regards
Maurizio

Hi Maurizio,

Please accept my apologies for late response.

I have successfully
exported the Docx/ODT files by using shared jrxml/XML files. Please find the output files in
attachment. The exception you are facing is due to the usage of following two Aspose.Words jar files in working library folder. Please put only one jar from in your working library folder.

The latest version of Aspose.Words for JasperReports 1.5.0 contains two jar files:

  1. aspose.words.jasperreports.jar
  2. aspose.words.jasperreports-3.7.1.jar

When you are using JasperReports version greater then 3.7.1, please use only aspose.words.jasperreports.jar file. The aspose.words.jasperreports-3.7.1.jar is for JasperReports
v.3.7.1 and lower versions.

Let me know, If you have any more queries.

Hi Tahir,
thank you for your support.
We downloaded the latest version and tried it out using our report: this report is rather more complex than the one we provided you for testing purposes (including nested reports), and the export ends up with an error:

Exception in thread "main"
net.sf.jasperreports.engine.JRException
at com.aspose.words.jasperreports.AWAbstractExporter.exportReport(Unknown Source)

Since your jar is compiled without the debug option, we can’t provide any more info on the error. The getCause() doesn’t add any info to the error message reported above.
This error happens both in version 3.7 and 4.1.3, using the 2 different jars you ship with the latest release.
Please let me know how we could help you detect where is the problem.

Thank you
Maurizio

Hi Maurizio,

Thanks for your query. I have tested the scenario with sub reports and have not found any issue with Aspose.Words for JasperReprots. It would be great, If you please share your jrxml files along with data source as XML for investigation purposes.

Maurizio
Can you please send me the sample example for exporting jasper to doc that contains subreports and along with it please send me the java files … Bcoz i’m not able to generate doc that contains subreports …

Hi Avinash,

Thanks for your inquiry. I have already answered your query here in this post. Please follow that thread for further proceedings.