| Saving birt output report on server side [message #649680] |
Thu, 20 January 2011 04:55  |
JIE Messages: 4 Registered: January 2011 |
Junior Member |
|
|
Hi all,
I'm using birt 2.3.2 to generate PDF report in the Java web application.
I could view the the output PDF in the firefox now, by clicking a button which will forward the request to a JSP page, in which the 'birt:viewer' object is defined.
But I also want to save the PDF into the disk of server side.
I'm thinking of writing a Java class extending ReportEventAdapter(Using afterRender event) and binding it with .rptdesign. But it seems no way to get content of report in java class...
Does anybody know how to do that? Or another solution to save the PDF?
Any information will be appreciated.
Thanks in advance!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Re: Saving birt output report on server side [message #1060483 is a reply to message #698008] |
Sat, 25 May 2013 03:27   |
Shashank kumar Messages: 3 Registered: May 2013 |
Junior Member |
|
|
Hi
This is working in birt 3.7.1 but not in 2.3.2 .In 2.3.2 give exception
given below..
org.eclipse.birt.report.engine.api.EngineException: Unhandled exception when executing script. at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:199)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.addException(ScriptExecutor.java:176) at
org.eclipse.birt.report.engine.script.internal.ReportScriptExecutor.handleBeforeRender(ReportScriptExecutor.java:123) at
org.eclipse.birt.report.engine.api.impl.EngineTask.startRender(EngineTask.java:1376) at org.eclipse.birt.report.engine.api.impl.RenderTask$PageRangeRender.render(RenderTask.java:510) at
org.eclipse.birt.report.engine.api.impl.RenderTask.render(RenderTask.java:209) at org.eclipse.birt.report.service.ReportEngineService.renderReport(ReportEngineService.java:1444) at
org.eclipse.birt.report.service.BirtViewerReportService.getPage(BirtViewerReportService.java:194) at
org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.doExecution(AbstractGetPageActionHandler.java:238) at
org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.__execute(AbstractGetPageActionHandler.java:105) at
org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90) at
org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47) at
org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143) at
org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPage(BirtDocumentProcessor.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at
java.lang.reflect.Method.invoke(Method.java:611) at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112) at
org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at
java.lang.reflect.Method.invoke(Method.java:611) at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397) at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186) at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323) at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) at
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454) at org.apache.axis.server.AxisServer.invoke(AxisServer.java:
281) at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699) at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:616) at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122) at
org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180) at
org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90) at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111) at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:59) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at
org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:269) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.mortbay.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:677) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568) at
org.mortbay.http.HttpContext.handle(HttpContext.java:1530) at org.mortbay.http.HttpContext.handle(HttpContext.java:1482) at org.mortbay.http.HttpServer.service(HttpServer.java:909) at
org.mortbay.http.HttpConnection.service(HttpConnection.java:820) at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:986) at
org.mortbay.http.HttpConnection.handle(HttpConnection.java:837) at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:245) at
org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357) at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534) Caused by: org.eclipse.birt.core.exception.CoreException:
There are errors evaluating script "mmap = reportContext.getHttpServletRequest().getAttribute("attributeBean").getModuleOptions(); rptdoc =
reportContext.getHttpServletRequest().getAttribute("attributeBean").getReportDocumentName(); importPackage(Packages.org.eclipse.birt.report.engine.api); importPackage(Packages.java.io) var
re = reportContext.getReportRunnable().getReportEngine(); var mdocument = re.openReportDocument(null,rptdoc, mmap); var options = new PDFRenderOption(); baos = new
ByteArrayOutputStream(); options.setOutputFormat("xls"); options.setOutputStream(baos); var ntask = re.createRenderTask(mdocument); ntask.setRenderOption(options); ntask.render();
ntask.close(); mdocument.close(); fout = new FileOutputStream("c:/test/testLocale.xls"); fout.write(baos.toByteArray()); fout.flush() fout.close(); ": The choice of Java constructor write matching
JavaScript argument types ([B) is ambiguous; candidate constructors are: void write(int) void write(byte[]) (/report/method[@name="beforeRender"]#20). at
org.eclipse.birt.core.script.ScriptContext.eval(ScriptContext.java:307) at org.eclipse.birt.core.script.ScriptContext.eval(ScriptContext.java:335) at
org.eclipse.birt.report.engine.executor.ExecutionContext.evaluate(ExecutionContext.java:665) at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleJSInternal(ScriptExecutor.java:60)
at org.eclipse.birt.report.engine.script.internal.ScriptExecutor.handleJS(ScriptExecutor.java:47) at
org.eclipse.birt.report.engine.script.internal.ReportScriptExecutor.handleBeforeRender(ReportScriptExecutor.java:115) ... 53 more Caused by: org.mozilla.javascript.EvaluatorException: The choice of
Java constructor write matching JavaScript argument types ([B) is ambiguous; candidate constructors are: void write(int) void write(byte[]) (/report/method[@name="beforeRender"]#20) at
org.mozilla.javascript.DefaultErrorReporter.runtimeError(DefaultErrorReporter.java:109) at org.mozilla.javascript.Context.reportRuntimeError(Context.java:1030) at
org.mozilla.javascript.Context.reportRuntimeError(Context.java:1086) at org.mozilla.javascript.Context.reportRuntimeError3(Context.java:1064) at
org.mozilla.javascript.NativeJavaMethod.findFunction(NativeJavaMethod.java:442) at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:157) at
org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66) at org.mozilla.javascript.gen.c7._c0(/report/method[@name="beforeRender"]:20) at org.mozilla.javascript.gen.c7.call(/
report/method[@name="beforeRender"]) at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:393) at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2834)
at org.mozilla.javascript.gen.c7.call(/report/method[@name="beforeRender"]) at org.mozilla.javascript.gen.c7.exec(/report/method[@name="beforeRender"]) at
org.eclipse.birt.core.script.ScriptContext.eval(ScriptContext.java:302) ... 58 more
any idea how to make it work in 2.3.2
Regards
[Updated on: Sat, 25 May 2013 03:28] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02318 seconds