BIRT reportEngine.openReportDesign(stream) hangs #1334
Closed
wernerreiche
started this conversation in
General
Replies: 1 comment
-
Caused by mismatched report template and report engine version numbers |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am using BIRT to generate PDF reports.
The code I have works in the development environment (windows), but when I install it on the operational system (centos), the OpenReportDesign call hangs. It just never returns from the call. Any ideas?
The output from the using version message is:
Centos: 2023-06-13 20:03:46.238 User[] DEBUG 3409 --- [AsynchThread-1] c.s.a.a.c.u.B.BirtReportCreator : createNonIataPdfDoc: Using version file:/var/www/abx/api/api.jar!/BOOT-INF/lib/org.eclipse.birt.runtime-3.7.2.v20120214-1408.jar!/
Windows: 2023-06-13 19:48:00.901 User[] DEBUG 30684 --- [ AsynchThread-1] c.s.a.a.c.u.B.BirtReportCreator : createNonIataPdfDoc: Using version /C:/Users/Werner/.m2/repository/org/eclipse/birt/runtime/org.eclipse.birt.runtime/3.7.2.v20120214-1408/org.eclipse.birt.runtime-3.7.2.v20120214-1408.jar
LOG.debug("createNonIataPdfDoc: OpenReportDesign for {}", invoice.global.accountName );
LOG.debug("createNonIataPdfDoc: Using version {}", reportEngine.getVersion());
IReportRunnable report = reportEngine.openReportDesign(stream);
The complete method is:
public byte[] createNonIataPdfDoc(InvoiceGenerationView igv, List airOperators,
List allFlights, List allInvRec,
List acctInvRecTtlList ) throws Exception {
LOG.debug("createNonIataPdfDoc: get template for CREDIT-INVOICE");
Template invoiceTemplate = templateService.findByName("CREDIT-INVOICE");
if ( invoiceTemplate == null ) {
throw new BirtException("createNonIataPdfDoc: No template found with name CREDIT-INVOICE");
}
LOG.debug("createNonIataPdfDoc: get template document for CREDIT-INVOICE");
byte[] templateDocument = invoiceTemplate.getTemplateDocument();
if (templateDocument == null) {
throw new BirtException("createNonIataPdfDoc: Template CREDIT-INVOICE does not have a template document");
}
LOG.debug("createNonIataPdfDoc: template doc size {}", templateDocument.length);
PDFMergerUtility pdfMergerUtility = new PDFMergerUtility();
List invoices = this.birtAviationInvoiceCreator.createInvoices(igv, allFlights, allInvRec, acctInvRecTtlList);
for (AviationInvoiceData invoice : invoices) {
final Document xmlDoc = documentBuilderFactory.newDocumentBuilder().newDocument();
final JAXBContext context = JAXBContext.newInstance(invoice.getClass());
final Marshaller marshaller = context.createMarshaller();
marshaller.marshal(invoice, xmlDoc);
if (WRITE_DEBUG_FILE) {
writeFromDocument(xmlDoc, "generatedXML_" + invoice.global.accountName + ".xml");
}
ByteArrayInputStream stream = new ByteArrayInputStream(templateDocument);
LOG.debug("createNonIataPdfDoc: OpenReportDesign for {}", invoice.global.accountName );
LOG.debug("createNonIataPdfDoc: Using version {}", reportEngine.getVersion());
IReportRunnable report = reportEngine.openReportDesign(stream);
LOG.debug("createNonIataPdfDoc: Done OpenReportDesign for {}", invoice.global.accountName );
byte[] output = generatePDFReport(report, xmlDoc, null);
pdfMergerUtility.addSource(new ByteArrayInputStream(output));
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
pdfMergerUtility.setDestinationStream(baos);
pdfMergerUtility.mergeDocuments(null);
return baos.toByteArray();
}
Beta Was this translation helpful? Give feedback.
All reactions