on 03-20-2009 8:59 AM
I have been trying to export CR XI R2 with SP2 reports to PDF using Eclipse JRE 1.5 below is my code:
/--
//Create the PDFExportFormatOptions object
PDFExportFormatOptions PDFExpOpts = new PDFExportFormatOptions();
//Create the ExportOptions object, set the PDF export options, and set the format type to PDF.
ExportOptions exOpts = new ExportOptions();
exOpts.setFormatOptions(PDFExpOpts);
exOpts.setExportFormatType(ReportExportFormat.from_int(ReportExportFormat._PDF));
/----
/--
InputStream lis;
PrintOutputController lpoc;
lpoc = oReportClientDocument.getPrintOutputController();
lis = lpoc.export(ReportExportFormat.from_int(ReportExportFormat._PDF));
return lis;
/----
When i run this code in Eclipse i get the below error:
16:56:29,187 INFO <b> PdfExporter: serializing pdf document and cleaning up
16:56:29,187 INFO [c] Disk Exporter: verifying export to destination
16:56:29,187 ERROR [c] Disk Exporter: no output file was created by an exporter
16:56:29,187 ERROR <b> PdfExporter: caught Exception in PDFFormatter.finalizeFormatJob (from destination?); aborting export
java.lang.IllegalArgumentException
at com.crystaldecisions.reports.exporters.destination.disk.c.a(Unknown Source)
at com.crystaldecisions.reports.exporters.format.page.pdf.b.a(Unknown Source)
at com.crystaldecisions.reports.a.e.if(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
at com.businessobjects.reports.sdk.b.i.int(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
at com.ec.copeccn.report.CrystalReportXIJob.exportToPDF(CrystalReportXIJob.java:192)
at com.ec.copeccn.report.CrystalReportXIJob.generatePDF(CrystalReportXIJob.java:171)
at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:230)
16:56:29,187 INFO [c] Disk Exporter: finalizing export to destination
16:56:29,187 ERROR [JRCCommunicationAdapter] JRCAgent1 detected an exception: java.lang.NullPointerException
at com.crystaldecisions.reports.queryengine.driverImpl.o.ew(Unknown Source)
at com.crystaldecisions.reports.queryengine.driverImpl.o.do(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.if(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.else(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.d4(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.f(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.dP(Unknown Source)
at com.crystaldecisions.reports.queryengine.av.if(Unknown Source)
at com.crystaldecisions.reports.queryengine.ba.if(Unknown Source)
at com.crystaldecisions.reports.queryengine.ba.do(Unknown Source)
at com.crystaldecisions.reports.queryengine.ba.try(Unknown Source)
at com.crystaldecisions.reports.queryengine.ba.for(Unknown Source)
at com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.j.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.j.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.a9.a(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.<init>(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.if(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.e.l.<init>(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.e.p.<init>(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.e.p.a(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
at com.businessobjects.reports.sdk.b.i.int(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
at com.ec.copeccn.report.CrystalReportXIJob.exportToPDF(CrystalReportXIJob.java:192)
at com.ec.copeccn.report.CrystalReportXIJob.generatePDF(CrystalReportXIJob.java:171)
at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:230)
16:56:29,187 INFO [JRCCommunicationAdapter] JRCAgent1 releasing license
Exception in thread "main" com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
at com.ec.copeccn.report.CrystalReportXIJob.exportToPDF(CrystalReportXIJob.java:192)
at com.ec.copeccn.report.CrystalReportXIJob.generatePDF(CrystalReportXIJob.java:171)
at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:230)
I'm trying to export rpt file which has CARGO_NAME as the parameter. In Crystal report i'm able to see the field in the Field Explorer -> Parameter Fields
When i build the java file and try to run the ECJboss, i get the below stated error for the same code:
2009-03-20 04:50:37,359 ECPM_DEV_Worker-9 WARN [com.crystaldecisions.reports.common.asserts.CrystalAssert ] Assertion Failed:
2009-03-20 04:50:37,375 ECPM_DEV_Worker-9 INFO [com.crystaldecisions.reports.common.asserts.CrystalAssert ] java.lang.Throwable
at com.crystaldecisions.reports.common.k.b.a(Unknown Source)
at com.crystaldecisions.reports.common.k.b.a(Unknown Source)
at com.crystaldecisions.reports.queryengine.b0.char(Unknown Source)
at com.crystaldecisions.reports.queryengine.b0.else(Unknown Source)
at com.crystaldecisions.reports.queryengine.b0.else(Unknown Source)
at com.crystaldecisions.reports.queryengine.b0.d(Unknown Source)
at com.crystaldecisions.reports.queryengine.b0.ds(Unknown Source)
at com.crystaldecisions.reports.queryengine.b0.dC(Unknown Source)
at com.crystaldecisions.reports.queryengine.b9.int(Unknown Source)
at com.crystaldecisions.reports.queryengine.b9.for(Unknown Source)
at com.crystaldecisions.reports.queryengine.b9.if(Unknown Source)
at com.crystaldecisions.reports.queryengine.b9.c(Unknown Source)
at com.crystaldecisions.reports.queryengine.b0.d(Unknown Source)
at com.crystaldecisions.reports.queryengine.b0.ds(Unknown Source)
at com.crystaldecisions.reports.reportdefinition.datainterface.l.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.k.l(Unknown Source)
at com.crystaldecisions.reports.dataengine.k.k(Unknown Source)
at com.crystaldecisions.reports.dataengine.k.bk(Unknown Source)
Can anyone help me to resolve this issue?
when i run this code in Eclipse, i get the following code as error
17:47:55,796 INFO [ReportDocument] Loading report definition.
17:47:57,218 WARN [ReportDocument] Failed to open export options stream
17:47:57,218 INFO [DocHistory] Document Save History:
17:47:57,218 INFO [DocHistory] History Group: 0
17:47:57,218 INFO [DocHistory] Saved Date = 2009.02.16 13:36:17 Malay Peninsula Standard Time
17:47:57,218 INFO [DocHistory] Build Version = 11.0.0.1282
17:47:57,218 INFO [DocHistory] Print Engine = CRW
17:47:57,218 INFO [DocHistory] OS = Windows XP
17:47:57,218 INFO [DocHistory] Architecture = x86
17:47:57,218 INFO [DocHistory] History Group: 1
17:47:57,218 INFO [DocHistory] Saved Date = 2009.03.30 17:39:40 Malay Peninsula Standard Time
17:47:57,218 INFO [DocHistory] Build Version = 11.5.8.826
17:47:57,218 INFO [DocHistory] Print Engine = CRW
17:47:57,218 INFO [DocHistory] OS = Windows XP
17:47:57,218 INFO [DocHistory] Architecture = x86
17:47:57,296 INFO [Compiler] Formula {@Record Selection} compiled.
17:47:57,296 INFO [Compiler] Formula {@Group Selection} compiled.
17:47:57,296 INFO [Compiler] Formula {@} compiled.
17:48:26,093 INFO [ReportDocument] Done loading report.
17:48:26,093 INFO [JRCCommunicationAdapter] Time to load report TankerBillOfLading.rpt took 32672 ms
17:48:26,437 INFO [JRCCommunicationAdapter] JRCAgent1 received request: compoundRequest
17:48:26,437 INFO [JRCCommunicationAdapter] JRCAgent1 received request: modifyParameterFieldCurrentValuesRequest
17:48:26,468 INFO [JRCCommunicationAdapter] JRCAgent1 received request: fetchReportExportRequest
17:48:26,468 INFO [JRCCommunicationAdapter] JRCAgent1 attempting to acquire license
17:48:26,468 INFO [JRCCommunicationAdapter] JRCAgent1 successfully acquired license
17:48:26,609 INFO [c] Export Supervisor: loading exporter com.crystaldecisions.reports.exporters.destination.disk.DiskExporter
17:48:26,812 INFO [c] Export Supervisor: loading available exporters
17:48:26,828 INFO [c] Export Supervisor: found 6exporters
17:48:26,828 INFO [c] Export Supervisor: loading exporter com.crystaldecisions.reports.exporters.format.page.pdf.PDFExporter
17:48:26,828 INFO [c] Export Supervisor: loading exporter com.crystaldecisions.reports.exporters.format.page.rtf.RTFExporter
17:48:26,828 INFO [c] Export Supervisor: loading exporter com.crystaldecisions.reports.exporters.format.report.crystalreports.CRExporter
17:48:26,843 INFO [c] Export Supervisor: loading exporter com.crystaldecisions.reports.exporters.format.record.sepv.SEPVExporter
17:48:26,859 INFO [c] Export Supervisor: loading exporter com.crystaldecisions.reports.exporters.destination.disk.DiskExporter
17:48:26,859 INFO [c] Export Supervisor: loading exporter daviss.jeff.cellexporter.CellExporter
17:48:26,859 ERROR [c] Export Supervisor: fail to load exporter (stack trace follows). This warning is only a problem if the exporter that failed to load is supported in a given project.daviss.jeff.cellexporter.CellExporter
java.lang.ClassNotFoundException: daviss.jeff.cellexporter.CellExporter
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.char(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
at com.businessobjects.reports.sdk.b.i.int(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
at com.ec.copeccn.report.CrystalReportXIJob.exportToPDF(CrystalReportXIJob.java:153)
at com.ec.copeccn.report.CrystalReportXIJob.generatePDF(CrystalReportXIJob.java:146)
at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:187)
17:48:27,015 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,cargo_name
,daytime
,to_char(daytime,'DD') day
,to_char(daytime,'Mon.') month
,to_char(daytime,'YYYY') year
,consignor_name
,tanker_name
,nationality
,master_name
,product_name
,product_anal_value
,port_name
,consignee_name
from zv_rep_bol
where cargo_name='{?CARGO_NAME}'
17:48:27,546 INFO [driverImpl] Logon: Connecting to database using local JNDI server ...
17:48:27,812 INFO [driverImpl] Connection Opened null
17:48:27,812 INFO [datainterface] Connection opened (Connection: databaseType=JDBC serverName=COPECCN state=open databaseDriverName=crdb_odbc.dll).
17:48:27,812 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,item_name
,load_value
from zv_rep_bol_analysis
where product_meas_no = 1
17:48:28,109 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,item_name
,load_value
from zv_rep_bol_analysis
where product_meas_no = 2
17:48:28,203 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,item_name
,load_value
from zv_rep_bol_analysis
where product_meas_no = 3
17:48:28,281 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,item_name
,load_value
from zv_rep_bol_analysis
where product_meas_no = 4
17:48:28,359 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,item_name
,load_value
from zv_rep_bol_analysis
where product_meas_no = 5
17:48:28,390 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,item_name
,load_value
from zv_rep_bol_analysis
where product_meas_no = 6
17:48:28,468 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,item_name
,load_value
from zv_rep_bol_analysis
where product_meas_no = 7
17:48:28,531 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,item_name
,load_value
from zv_rep_bol_analysis
where product_meas_no = 8
17:48:28,593 INFO [c] Export Supervisor: exporting pages
17:48:28,687 INFO [dataengine] Detected new parameter values - report parameters has changed
17:48:28,687 INFO [dataprocessor] Report parameters is changed
17:48:28,687 INFO [dataengine] Handling report parameters changes
17:48:28,687 INFO [dataengine] Validating report parameters
17:48:28,687 INFO [dataengine] Creating new data source
17:48:28,687 INFO [dataengine] Create new report state
17:48:28,890 INFO [datasource] Creating totaller
17:48:29,015 INFO [dataengine] Checking for data source changes
17:48:29,031 INFO [reportstate90] Checking for report state changes.
17:48:29,062 INFO [reportstate90] Database fields changed
17:48:29,062 INFO [reportstate90] Print Time Formula fields changed
17:48:29,062 INFO [reportstate90] Linking changed
17:48:29,062 INFO [reportstate90] Finished checking for report state changes.
17:48:29,062 INFO [dataengine] Data Source Manager handling report changes
17:48:29,062 INFO [datasource] Data Source handling report changes.
17:48:29,062 INFO [datasource] Invalidate saved data, database fields are changed.
17:48:29,062 INFO [datasource] Invalidate saved data, linking is changed.
17:48:29,062 INFO [datasource] Invalidating controller
17:48:29,062 INFO [datasource] Invalidating totaller
17:48:29,062 INFO [datasource] At the moment the code should ALWAYS regenerate the controller rather than recycle parts of it in place.
17:48:29,062 INFO [datasource] Updating special var fields
17:48:29,062 INFO [datasource] No constant formulas
17:48:29,062 INFO [datasource] Creating totaller
17:48:29,062 INFO [dataengine] Should verify database
17:48:29,062 INFO [dataengine] Verifying database
17:48:29,250 INFO [queryengine] Executing query: select parcel_no
,cargo_no
,cargo_name
,daytime
,to_char(daytime,'DD') day
,to_char(daytime,'Mon.') month
,to_char(daytime,'YYYY') year
,consignor_name
,tanker_name
,nationality
,master_name
,product_name
,product_anal_value
,port_name
,consignee_name
from zv_rep_bol
where cargo_name='PLC-219'
17:48:29,312 INFO <b> PdfExporter: serializing pdf document and cleaning up
17:48:29,312 INFO [c] Disk Exporter: verifying export to destination
17:48:29,312 ERROR [c] Disk Exporter: no output file was created by an exporter
17:48:29,312 ERROR <b> PdfExporter: caught Exception in PDFFormatter.finalizeFormatJob (from destination?); aborting export
java.lang.IllegalArgumentException
at com.crystaldecisions.reports.exporters.destination.disk.c.a(Unknown Source)
at com.crystaldecisions.reports.exporters.format.page.pdf.b.a(Unknown Source)
at com.crystaldecisions.reports.a.e.if(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
at com.businessobjects.reports.sdk.b.i.int(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
at com.ec.copeccn.report.CrystalReportXIJob.exportToPDF(CrystalReportXIJob.java:153)
at com.ec.copeccn.report.CrystalReportXIJob.generatePDF(CrystalReportXIJob.java:146)
at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:187)
17:48:29,312 INFO [c] Disk Exporter: finalizing export to destination
17:48:29,312 ERROR [JRCCommunicationAdapter] JRCAgent1 detected an exception: java.lang.NullPointerException
at com.crystaldecisions.reports.queryengine.driverImpl.o.ew(Unknown Source)
at com.crystaldecisions.reports.queryengine.driverImpl.o.do(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.if(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.else(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.d4(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.f(Unknown Source)
at com.crystaldecisions.reports.queryengine.ao.dP(Unknown Source)
at com.crystaldecisions.reports.queryengine.av.if(Unknown Source)
at com.crystaldecisions.reports.queryengine.ba.if(Unknown Source)
at com.crystaldecisions.reports.queryengine.ba.do(Unknown Source)
at com.crystaldecisions.reports.queryengine.ba.try(Unknown Source)
at com.crystaldecisions.reports.queryengine.ba.for(Unknown Source)
at com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.j.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.j.a(Unknown Source)
at com.crystaldecisions.reports.dataengine.a9.a(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.<init>(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.if(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.e.l.<init>(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.e.p.<init>(Unknown Source)
at com.crystaldecisions.reports.formatter.formatter.e.p.a(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source)
at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source)
at com.businessobjects.reports.sdk.b.i.int(Unknown Source)
at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source)
at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
at com.ec.copeccn.report.CrystalReportXIJob.exportToPDF(CrystalReportXIJob.java:153)
at com.ec.copeccn.report.CrystalReportXIJob.generatePDF(CrystalReportXIJob.java:146)
at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:187)
17:48:29,312 INFO [JRCCommunicationAdapter] JRCAgent1 releasing license
Exception in thread "main" com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: java.lang.NullPointerException---- Error code:-2147467259 Error code name:failed
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source)
at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source)
at com.ec.copeccn.report.CrystalReportXIJob.exportToPDF(CrystalReportXIJob.java:153)
at com.ec.copeccn.report.CrystalReportXIJob.generatePDF(CrystalReportXIJob.java:146)
at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:187)
Is this issue caused due to incorrect import statements or there are some issue with the jar that i am using?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well in your code you are passing Report and the parameter value.
But then you nowhere have opened the report.. how will it read the content?
Also you need to set the Content Type as pdf to the response object.
You also need to set the streams to the response.
Heres some sample code for you...
-
reportClientDocument.open("Statement of Account.rpt", OpenReportOptions._openAsReadOnly);
reportSource = reportClientDocument.getReportSource();
session.setAttribute("ReportSource", reportSource);
byteArrayInputStream = (ByteArrayInputStream) reportClientDocument
.getPrintOutputController().export(ReportExportFormat.PDF);
response.reset();
response.setHeader("Content-disposition", "inline;filename=crreport.pdf");
response.setContentType("application/pdf");
byteArray = new byte[1024];
while((bytesRead = byteArrayInputStream.read(byteArray)) != -1) {
response.getOutputStream().write(byteArray, 0, bytesRead);
}
response.getOutputStream().flush();
response.getOutputStream().close();
reportClientDocument.close();
Hope this helps.
Regards,
Tej
I changed the code from
oReportClientDocument.open(reportFilename, 0);
to
oReportClientDocument.open(reportFilename, OpenReportOptions._openAsReadOnly);
and i get the following error message
14:02:09,500 ERROR [c] Disk Exporter: no output file was created by an exporter 14:02:09,500 ERROR <b> PdfExporter: caught Exception in PDFFormatter.finalizeFormatJob (from destination?); aborting export java.lang.IllegalArgumentException at com.crystaldecisions.reports.exporters.destination.disk.c.a(Unknown Source) at com.crystaldecisions.reports.exporters.format.page.pdf.b.a(Unknown Source) at com.crystaldecisions.reports.a.e.if(Unknown Source) at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source) at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source) at com.businessobjects.reports.sdk.b.i.int(Unknown Source) at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source) at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source) at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source) at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source) at com.ec.copeccn.report.CrystalReportXIJob.exportToPDF(CrystalReportXIJob.java:160) at com.ec.copeccn.report.CrystalReportXIJob.generatePDF(CrystalReportXIJob.java:153) at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:194) INFO [c] Disk Exporter: finalizing export to destination 14:02:09,500 ERROR [JRCCommunicationAdapter] JRCAgent1 detected an exception: java.lang.NullPointerException at com.crystaldecisions.reports.queryengine.driverImpl.o.ew(Unknown Source) at com.crystaldecisions.reports.queryengine.driverImpl.o.do(Unknown Source) at com.crystaldecisions.reports.queryengine.ao.if(Unknown Source) at com.crystaldecisions.reports.queryengine.ao.else(Unknown Source) at com.crystaldecisions.reports.queryengine.ao.d4(Unknown Source) at com.crystaldecisions.reports.queryengine.ao.f(Unknown Source) at com.crystaldecisions.reports.queryengine.ao.dP(Unknown Source) at com.crystaldecisions.reports.queryengine.av.if(Unknown Source) at com.crystaldecisions.reports.queryengine.ba.if(Unknown Source) at com.crystaldecisions.reports.queryengine.ba.do(Unknown Source) at com.crystaldecisions.reports.queryengine.ba.try(Unknown Source) at com.crystaldecisions.reports.queryengine.ba.for(Unknown Source) at com.crystaldecisions.reports.reportdefinition.datainterface.j.a(Unknown Source) at com.crystaldecisions.reports.dataengine.j.a(Unknown Source) at com.crystaldecisions.reports.dataengine.j.a(Unknown Source) at com.crystaldecisions.reports.dataengine.a9.a(Unknown Source) at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.<init>(Unknown Source) at com.crystaldecisions.reports.formatter.formatter.objectformatter.bv.if(Unknown Source) at com.crystaldecisions.reports.formatter.formatter.e.l.<init>(Unknown Source) at com.crystaldecisions.reports.formatter.formatter.e.p.<init>(Unknown Source) at com.crystaldecisions.reports.formatter.formatter.e.p.a(Unknown Source) at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source) at com.crystaldecisions.reports.formatter.a.c.if(Unknown Source) at com.crystaldecisions.reports.formatter.a.c.a(Unknown Source) at com.businessobjects.reports.sdk.b.i.int(Unknown Source) at com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(Unknown Source) at com.crystaldecisions.proxy.remoteagent.y.a(Unknown Source) at com.crystaldecisions.proxy.remoteagent.r.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.cf.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.ReportSource.a(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source) at com.crystaldecisions.sdk.occa.report.application.PrintOutputController.export(Unknown Source) at com.crystaldecisions.reports.sdk.PrintOutputController.export(Unknown Source) at com.ec.copeccn.report.CrystalReportXIJob.exportToPDF(CrystalReportXIJob.java:160) at com.ec.copeccn.report.CrystalReportXIJob.generatePDF(CrystalReportXIJob.java:153) at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:194) 14:02:09,500 INFO [JRCCommunicationAdapter] JRCAgent1 releasing license at com.ec.copeccn.report.CrystalReportXIJob.main(CrystalReportXIJob.java:194)
Edited by: narin_rai on Apr 3, 2009 8:09 AM
Please try the code.
Hope it helps.
import com.crystaldecisions.reports.sdk.*;
import com.crystaldecisions.sdk.occa.report.lib.*;
import com.crystaldecisions.sdk.occa.report.exportoptions.*;
import java.io.*;
public class JRCExportReport {
static final String REPORT_NAME = "Absolute path to the report to be used in the code";
static final String EXPORT_FILE = "Absolute path to the .pdf file to create";
public static void main(String[] args) {
try {
//Open report.
ReportClientDocument reportClientDoc = new ReportClientDocument();
reportClientDoc.open(REPORT_NAME, 0);
//NOTE: If parameters or database login credentials are required, they need to be set before.
//calling the export() method of the PrintOutputController.
//Export report and obtain an input stream that can be written to disk.
//See the Java Reporting Component Developer's Guide for more information on the supported export format enumerations
//possible with the JRC.
ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
//Release report.
reportClientDoc.close();
//Use the Java I/O libraries to write the exported content to the file system.
byte byteArray[] = new byte[byteArrayInputStream.available()];
//Create a new file that will contain the exported result.
File file = new File(EXPORT_FILE);
FileOutputStream fileOutputStream = new FileOutputStream(file);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(byteArrayInputStream.available());
int x = byteArrayInputStream.read(byteArray, 0, byteArrayInputStream.available());
byteArrayOutputStream.write(byteArray, 0, x);
byteArrayOutputStream.writeTo(fileOutputStream);
//Close streams.
byteArrayInputStream.close();
byteArrayOutputStream.close();
fileOutputStream.close();
System.out.println("Successfully exported report to " + EXPORT_FILE);
}
catch(ReportSDKException ex) {
ex.printStackTrace();
}
catch(Exception ex) {
ex.printStackTrace();
}
}
}
Thanks Tej for your reply
Here is my line of code:
import java.io.ByteArrayOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
//import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.Map;
import oracle.sql.BLOB;
import com.crystaldecisions.reports.sdk.ReportClientDocument;
import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;
import com.crystaldecisions.sdk.occa.report.lib.ReportSDKException;
import com.crystaldecisions.sdk.occa.report.lib.ReportSDKExceptionBase;
import com.crystaldecisions.thirdparty.com.ooc.CORBA.InputStream;
public class CrystalReportXIJob extends ECInternalReportJob{
public CrystalReportXIJob(long reportNo, int execOrder) throws ReportException{
super(reportNo, execOrder);
}
public static void main(String[] args) throws Exception {
CrystalReportXIJob c = new CrystalReportXIJob(0, 0);
c.generatePDF("TankerBillOfLading.rpt", "PLC-219");
}
private void generatePDF(String reportFilename, String cargoName) throws ReportSDKExceptionBase {
ReportClientDocument oReportClientDocument = new ReportClientDocument();
oReportClientDocument.open(reportFilename, 0);
oReportClientDocument.getDataDefController().getParameterFieldController().setCurrentValue("", "CARGO_NAME", cargoName);
InputStream lis = exportToPDF(oReportClientDocument);
writeToFile(lis);
}
private InputStream exportToPDF(ReportClientDocument oReportClientDocument) throws ReportSDKException {
InputStream lis = (InputStream) oReportClientDocument.getPrintOutputController().export(ReportExportFormat.PDF);
return lis;
}
private void writeToFile(InputStream lis) {
try {
FileOutputStream out = new FileOutputStream("test.pdf");
byte[] buf = new byte[4096];
int len;
while ((len = lis.read(buf)) > 0) {
out.write(buf, 0, len);
}
lis.close();
out.close();
} catch (IOException e) {
System.err.println(e.toString());
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can u give some details about the environment you are using? like
1. Which version of Eclipse you are using?
2. Which application server(version) are you using?
Thanks,
Tej
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I wondering whether JBoss is supported or not for CR XI R2
Check out this link
Thanks,
Tej
JBoss that i'm having on my machine is running on Tomcat 5.5. I don't face any problem i'm when i'm exporting a PDF with no parameters. It only occurs when i try to export a report which has parameters that need to be defined. Upon checking on the log, i find that the parameter is being passed correctly to the query as shown below:
2009-03-20 05:54:03,734 ECPM_DEV_Worker-5 INFO [com.crystaldecisions.reports.queryengine ] Executing query: select parcel_no
,cargo_no
,cargo_name
,daytime
,to_char(daytime,'DD') day
,to_char(daytime,'Mon.') month
,to_char(daytime,'YYYY') year
,consignor_name
,tanker_name
,nationality
,master_name
,product_name
,product_anal_value
,port_name
,consignee_name
from zv_rep_bol
where cargo_name='PLC-219'
The code that is used to assign the value of the parameter is as below:
oReportClientDocument.getDataDefController().getParameterFieldController().setCurrentValue("", "CARGO_NAME", cargoName);
Edited by: narin_rai on Mar 23, 2009 2:07 AM
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.