kburns Posted May 6, 2011 Share Posted May 6, 2011 In the web services sample webapp, I found the following commented out code (in executeReport.jsp) /* -------- The commented code below shows how to get from the webserive a JasperPrint instead of a final file format (like PDF) and use directly the JasperReports library to create the output with the maximum control over the exporter. ---------------------------------------------------------- JasperPrint print = client.runReport(currentUri, hashMap); net.sf.jasperreports.engine.JRExporter exporter = null; if (request.getParameter("format") == null || request.getParameter("format").equals("html")) { response.setContentType("text/html"); response.setCharacterEncoding("UTF-8"); exporter = new net.sf.jasperreports.engine.export.JRHtmlExporter(); JRHyperlinkProducerMapFactory producerFactory = new JRHyperlinkProducerMapFactory(); producerFactory.addProducer("ReportExecution", new ReportExecutionHyperlinkProducer()); exporter.setParameter(JRExporterParameter.HYPERLINK_PRODUCER_FACTORY, producerFactory); request.getSession().setAttribute(net.sf.jasperreports.j2ee.servlets.ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, print); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "image?image="); } else if (request.getParameter("format").equals("pdf")) { response.setContentType("application/pdf"); exporter = new net.sf.jasperreports.engine.export.JRPdfExporter(); } else if (request.getParameter("format").equals("xls")) { response.setContentType("application/msexcel"); response.setHeader("Content-Disposition", " inline; filename=report.xls"); exporter = new net.sf.jasperreports.engine.export.JExcelApiExporter(); } os = response.getOutputStream(); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, os); exporter.setParameter(JRExporterParameter.JASPER_PRINT, print); exporter.exportReport(); */ I am implementing this, but getting the following exception error:SEVERE: Servlet.service() for servlet default threw exception java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser at net.sf.jasperreports.engine.JRAbstractExporter.setJasperPrint(JRAbstractExporter.java:800) at net.sf.jasperreports.engine.JRAbstractExporter.setInput(JRAbstractExporter.java:867) What I am missing? JRStyledTextParser has been included and the jar exists in my class path (jasperreports-4.0.0.jar)Post Edited by kburns at 05/06/2011 18:27 Link to comment Share on other sites More sharing options...
kburns Posted May 6, 2011 Author Share Posted May 6, 2011 Oh yes, and as a follow up... My goal is to implement pagination within my web services. For example, run a report and get the 1st page, then the 2nd, etc. Seems likesimple stuff that has already been handled by many people here.I am using 4.0. I have already looked at pages 24-25 in the web services documentation, but they were no help. My concern is that something changed in 4.0 that was not documented in the pdf or changed in the sample webapp. Any *working* code snippets would be extremely useful. Thanks for your help! Link to comment Share on other sites More sharing options...
kburns Posted May 10, 2011 Author Share Posted May 10, 2011 This may actually have less to do with...net.sf.jasperreports.engine.util.JRStyledTextParserthan it does with...java.lang.NoClassDefFoundErrorAny ideas on what is missing? The jar that defines JRStyledTextParser is in my classpath. Has anyone else run across this problem?Post Edited by kburns at 05/10/2011 16:41 Link to comment Share on other sites More sharing options...
Solution kburns Posted June 6, 2011 Author Solution Share Posted June 6, 2011 Problem solved. My client was using jar for 4.0, but our server was running 4.0.1. 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