2005 IR Help Posted August 26, 2006 Share Posted August 26, 2006 By: Chris Bliesner - cpb8359 re: Jasper Assistant 2004-05-19 13:06 I purchased Jasper Assistant and created a report with it no problem on the windows side. I ftp'd the report to Unix and I would like to be able to run it as a webapp, having a JSP or servlet call it using Jasper Reports. Any ideas? Chris By: Chris Bliesner - cpb8359 re: Jasper Assistant 2004-05-24 12:15 Thanks for the help--When I run this code with Tomcat on Unix I get the following errors. I substituted my compiled/filled JasperAssistant report named (test.jrxml) with m_jdPrintOut: HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 12 in the jsp file: /rptnew.jsp Generated servlet error: [javac] Compiling 1 source file /usr/local/jakarta-tomcat-4.1.12/work/Standalone/epdata02.elps.bna.boeing.com/bliesncp/rptnew_jsp.java:45: illegal start of expression public boolean sendToBrowser(HttpServletRequest httpservletrequest HttpServletResponse httpservletresponse, DownLoadDescription desc ) ^ An error occurred at line: -1 in the jsp file: null Generated servlet error: /usr/local/jakarta-tomcat-4.1.12/work/Standalone/epdata02.elps.bna.boeing.com/bliesncp/rptnew_jsp.java:73: ';' expected } ^ 2 errors at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293) at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:313) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:324) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2396) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:380) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533) at java.lang.Thread.run(Thread.java:479) -------------------------------------------------------------------------------- Apache Tomcat/4.1.12 By: Chris Bliesner - cpb8359 re: Jasper Assistant 2004-05-25 08:26 Never mind, I figured it out, thanks! Chris By: Mark Engstrom - me2kme re: Jasper Assistant 2004-05-20 03:34 This may not be the finest technical solution but it is one we have used. We have a version of embedded tomcat running on our application server. This serves rather simple servlets, haven't used JSPs in this case I'm afraid. Here are some code snipets. Our servlets extend HttpServlet and implement the public void doPost(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse) method. From that we get certain parameters about the type of report we are to display. We then use the following code to display either the PDF version or excel version of the report using the following code : In this case object DownLoadDescription is a really simple wrapper class for describing the report to be displayed. m_jdPrintOut is the JasperPrint object of the already compiled and filled jasperreport. /** * Outputs the PDF to a browser. * Requires that the report has already been generated and filled. * @param the http request * @param the http response * @param a description of the report, contains downloadType, name etc. * @return can be ignored at this time */ public boolean sendToBrowser(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse, DownLoadDescription desc ) { boolean success = false; try { ServletOutputStream out = httpservletresponse.getOutputStream(); if ( desc.typeIsCSV() ) { httpservletresponse.setContentType("application/excel"); httpservletresponse.setHeader("Content-disposition", "attachment; filename=" + ( desc.getBasicReportName() + RunnableUserReport.CSV ) ); JRCsvExporter exporter = new JRCsvExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, m_jdPrintOut); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out); exporter.exportReport(); } else { httpservletresponse.setContentType("application/pdf"); JasperExportManager.exportReportToPdfStream(m_jdPrintOut, out); } success = true; } catch (Exception e) { e.printStackTrace(); } return success; } Hope it helps. By: Druzya - druzya re: Jasper Assistant 2004-07-14 02:24 hi me2kme! your solution is quite interesting, but i get an error on the exporter.exportReport(); dori.jasper.engine.JRException: No input source supplied to the exporter. i don't understand what does it mean... didn't i pass a filled jrprint object? isn't it enough? thanks a lot for your help Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now