Jnlp with jasper report

hi ia have one java Frame in which i enter the no.and according to number it ghenereate report from data base.using jasper report
i have one test.jar and one test.jrxml file for jasper report
how can i start jasper report with jnlp

hi ia have one java Frame in which i enter the no.and
according to number it ghenereate report from data
base.using jasper reportEither Jasper reports will need to be 'installed',
or it will need to have its classes on the application's
runtime classpath. The last one is probably the
better strategy, but the first is also possible, using
a (web start) installer (element).
Can you run this from the command line?
If so, what exact command do you use to run it?
i have one test.jar and one test.jrxml file How does the code load the .jrxml file?
A File("test.jrxml") approach would be a
problem for web start.
The best way is to put it also on the application's
classpath (probably by putting it in a Jar it and
adding the jar to the classpath), then use getResource()
to get an URL pointing to it.
..for
jasper report
how can i start jasper report with jnlpThen there is the question of whether the DB
and JNLP will be coming from the same server,
which means the code can be sandboxed, or
whether it requires code signing and extended
permissions.
What does the frame do with the report once it
is generated? Is it written to disk, or printed?
This question breaks down to many parts.
Message was edited by:
AndrewThompson64

Similar Messages

  • Trying to generate a pdf with jasper reports

    Fellas,
    i hav trying to generate a pdf with jasper reports, but i cant. I create a file .jasper with iReports. This is my code:
    emite.java
    package utilitarios;
    //import net.sf.jasperreports
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.view.JasperViewer;
    import java.sql.*;
    import java.util.*;
    import javax.swing.*;
    import java.util.HashMap;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class emitebl {
    private static Connection getConnection( ) throws ClassNotFoundException, SQLException{
    String driver = "org.postgresql.Driver";
    String url = "jdbc:postgresql://localhost/sist";
    String user = "usuario";
    String password = "";
    Class.forName(driver);
    Connection con = DriverManager.getConnection( url, user, password );
    return con;
    public void geraRelatorio( ) throws JRException, Exception{
    Connection con = getConnection( );
    Statement stm = con.createStatement( );
    String query = "SELECT * FROM emissaobl WHERE id=4";
    ResultSet rs = stm.executeQuery(query);
    JRResultSetDataSource jrRS = new JRResultSetDataSource(rs);
    Map parameters = new HashMap();
    JasperFillManager.fillReportToFile("emitebl.jasper",parameters,jrRS);
    JasperExportManager.exportReportToPdfFile("emitebl.jrprint");
    JasperViewer.viewReport("emissao_bl.pdf",false);
    } emissao.jsp:
    <%@ page import="utilitarios.*" %>
    <%
    new emitebl().geraRelatorio();
    %>Following the error message exception:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: emitebl.jasper
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
         org.apache.jsp.emissaobl.exportapdf_jsp._jspService(exportapdf_jsp.java:76)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    root cause
    net.sf.jasperreports.engine.JRException: emitebl.jasper
         net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:73)
         net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:270)
         utilitarios.emitebl.geraRelatorio(emitebl.java:37)
         org.apache.jsp.emissaobl.exportapdf_jsp._jspService(exportapdf_jsp.java:54)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)where i hav to put the .jasper file?

    Hi,
    If you have placed your .jrxml file say in C:\reports, and when you use compileReportToFile(jrxmlFileName), then the jasper file will be created in the same directory C:\report with the same file name with .jasper extension. If you want a pdf report then specify the same location and file name with '.pdf' extension as destination .
    Hope this helps

  • JSF with Jasper Reports

    Hi,
    I am a new bie to JSF and also Jasper Reports.
    I Have created a JSF page where by passing fromDate and toDate from UI passed as a parameter to Jasperreport to generate a report.
    Report is generated as a pdf but my requirement is i want to view the pdf in the browser.
    I used with runReportToPdf(), but with this i dont no how to get the servletConfig whereby in some code i got the code to get the servletConfig and servletContext and passing the .jasper file to convert it as a inputStream or a File.
    I think this is not the proper way to view the things in browser bcoz i want to show the Excel and CSV report also in the browser.
    Could anyone Pls help me in this. Is there any other way to do this.
    My Code:
    <code>
    public void execute()
         try
              FacesContext context = FacesContext.getCurrentInstance();
              Object ObjTest = context.getExternalContext().getSessionMap().get("awardCodeMast");
              AwardCodeMast aObj = (AwardCodeMast)ObjTest;
                        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                        Date fromDate1 = aObj.getEffectiveFromDate();
                        String s1 = df.format(fromDate1);
                        System.out.println("#####################"+s1);
              Date toDate1 = aObj.getEffectiveToDate();
              String s2 = df.format(toDate1);
              System.out.println("#####################"+s2);
                        // Started with Jasper Reports
              JasperReport jasperReport;
              JasperPrint jasperPrint;
              JRResultSetDataSource obj;
              JasperDesign jasperDesign;
              JRDataSource jr1;
              String fromDate = s1;
              String toDate = s2;
              Class.forName("com.mysql.jdbc.Driver");
              Connection con1=DriverManager.getConnection("jdbc:mysql://HARUNS-ATHITHI.ITCINFOTECH.COM/pba","root","root");
              Statement stmt1=con1.createStatement();
              Map<String, Serializable> parameters = new HashMap<String, Serializable>();
              parameters.put("fromDate", fromDate);
              parameters.put("toDate", toDate);
              System.out.println("Put...........");
              String ss = context.getExternalContext().getRequestServletPath();
              System.out.println("SS : "+ss+"...............");
              byte[] bytes = null;
              ServletOutputStream outstream = null;
              InputStream reportStream = context.getExternalContext().getResourceAsStream("D:/Acegi Security Framework/Sample_WS1/PBA/WebContent/reports/pdffrmt/AwardCode_report_1.jasper");
              HttpServletResponse response = (HttpServletResponse)context.getExternalContext().getResponse();
              outstream = response.getOutputStream();     
              ExternalContext extContext = context.getExternalContext();
              ServletContext servletContext = (ServletContext) extContext.getContext();
              File reportFile = new File("D:/Acegi Security Framework/Sample_WS1/PBA/WebContent/reports/pdffrmt/AwardCode_report_1.jasper");
              jasperDesign = JasperManager.loadXmlDesign("D:/Acegi Security Framework/Sample_WS1/PBA/WebContent/reports/pdffrmt/AwardCode_report_1.jrxml");
         System.out.println("1..................");
         jasperReport = JasperCompileManager.compileReport(jasperDesign);
         System.out.println("2...................");     
         JasperRunManager.runReportToPdfStream(reportStream, outstream, parameters, con1);
         jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, con1);
         System.out.println("3...............");
         String ss1 = (String)context.getExternalContext().getRequestPathInfo();
         System.out.println(ss1+"............................");
         System.out.println("Report generated....................");
         response.setContentType("application/pdf");
         response.setContentLength(bytes.length);
         System.out.println("Setting content type..................");
         System.out.println("getting output Stream...........");
         response.setContentLength(bytes.length);
         System.out.println("setting the context length...........");
         JasperRunManager.runReportToPdfStream(reportStream, outstream,parameters, con1);
         //outstream.write(bytes);
         System.out.println("writing byte array.............");
         outstream.flush();
         System.out.println("flushing out..............");
         outstream.close();
         ret_sta = "Success";
         }catch(Exception e){System.out.println(e);}
         System.out.println(ret_sta+".....................");
         FacesContext context = FacesContext.getCurrentInstance();
    context.responseComplete();
    </code>
    Kindly help me, i would be very thankful to u.
    Thanks,
    Ambika.

    Hi,
    I want to display a pdf through a web browser. I got it to work with my one report but my other one do not want to work.
    Here is my code.
    public void executeShiftReport(Calendar dateOfReport) {
    try {
    Calendar calMrng = new GregorianCalendar(dateOfReport.get(Calendar.YEAR), dateOfReport.get(Calendar.MONTH), dateOfReport.get(Calendar.DAY_OF_MONTH), 06, 00);
    Date reportDate = dateOfReport.getTime();
    Date dateMrng = calMrng.getTime();
    JasperPrint jasperPrint;
    Connection conn = establishConnection();
    //the paramaters of the report will be saved within the hashmap
    HashMap jasParam = new HashMap();
    jasParam.put("fromDateMorning", new Timestamp(dateMrng.getTime()));
    jasParam.put("Date", reportDate);
    // adds 1 day to the calender to get tomorrows date for night shift ending
    calMrng.add(Calendar.DAY_OF_MONTH, 1);
    Date dateMoreMrng = calMrng.getTime();
    jasParam.put("toDateMorning", new Timestamp(dateMoreMrng.getTime()));
    File file = new File("E:/Projects/BranSystems Internal/BranSupportLog/reports/");
    jasperPrint = JasperFillManager.fillReport(new FileInputStream(new File(file, "morningShift.jasper")), jasParam, conn);
    // JasperExportManager.exportReportToPdf(jasperPrint);
    // JasperExportManager.exportReportToHtmlFile(jasperPrint, "E:/Projects/BranSystems Internal/BranSupportLog/reports/morningShift.html");
    byte[] bytes = JasperExportManager.exportReportToPdf(jasperPrint);
    FacesContext context = FacesContext.getCurrentInstance();
    HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
    // let the pdf display in the same window with 'inline',
    response.setHeader("Content-disposition", "inline;filename=morningShift.pdf;");
    response.setContentType("application/pdf");
    response.setContentLength(bytes.length);
    response.getOutputStream().write(bytes);
    response.flushBuffer();
    context.responseComplete();
    } catch (JRException ex) {
    Logger.getLogger(SupportMBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (FileNotFoundException ex) {
    Logger.getLogger(SupportMBean.class.getName()).log(Level.SEVERE, null, ex);
    } catch (IOException ex) {
    Logger.getLogger(SupportMBean.class.getName()).log(Level.SEVERE, null, ex);
    }

  • Edition with jasper report

    I want to edit with jasper report so I have this 2 classes.In the first I have this method
    private Map parameters;
    public void addParametre(String nom, Object valeur)
    if(parameters == null)
    parameters = new HashMap();
    parameters.put(nom, valeur);
    and the second class I have this method
    public String editionAction() {
    ReportGeneratorImmat ge =new ReportGeneratorImmat((String)getForRep().getValue()) ;
    String pWhere="matr='145-A' and";
    String pOrder="order by nom";
    ge.addParametre("P_WHERE",pWhere);
    ge.addParametre("P_ORDER",pOrder);
    return null;
    the problem is that the first parametre (P_WHERE) is successfully added but the the second (P_Order) no. So how can I add both?

    Seems that this question would be better asked on the Jasper Report forums, no?
    John

  • Problems with jasper report pdf exporting

    Hello,
    I coded a simple servlet to view a jasper report (created with iReport) after clicking on the right button in the jsp.
    Here is the problem:
    net.sf.jasperreports.engine.JRRuntimeException: Error evaluating expression :
         Source text : (java.awt.Image)it.businesslogic.ireport.chart.DefaultChartFactory.drawChart(new String[]{"chartName=Pie3D","depthFactor=0.2","titlePosition=1","width=245","plotBackground=[255,255,255]","serie1=SERIE_CONTA_RISPOSTE","serie0=SERIE_RISPOSTA","foregroundAlpha=0.33","tooltips=false","chartBackground=[255,255,255]","subtitle=","title=","legend=true","quality=2","height=168","antialias=true"}, (it.businesslogic.ireport.IReportScriptlet)$P{REPORT_SCRIPTLET})
         net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:604)
         net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:343)
         net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311)
         net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275)
         net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1302)
         net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631)
         net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:228)
         net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)
         net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:730)
         net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:632)
         net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)
         net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
         net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234)
         net.sf.jasperreports.engine.JasperRunManager.runReportToPdf(JasperRunManager.java:203)
         customer_care.servlet.Reporting.getReport(Reporting.java:74)
         customer_care.servlet.Reporting.processRequest(Reporting.java:50)
         customer_care.servlet.Reporting.doGet(Reporting.java:89)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Here is the code:
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            byte[] byte_array = null;
            try{
                File reportFile = new File(this.getServletConfig().getServletContext().getRealPath("/reports/torte_call_center_agenzie.jasper"));
                if (!reportFile.exists()) throw new JRRuntimeException("File jasper non trovato");
                String nomeFile = reportFile.getPath();
                Map parameters = new HashMap();
                parameters.put("codice_questionario", "2");   //just for testing
                ConnettitiAlDB c = new ConnettitiAlDB();
                Connection conn = c.Connettiti(Conf.db_principale);
                byte_array = JasperRunManager.runReportToPdf(fullpath_filename, parameters, connessione);
                conn.close();
            catch(JRException e){
                e.printStackTrace();
            catch(SQLException e) {
                e.printStackTrace();
            response.setContentType("application/pdf");
         response.setContentLength(byte_array.length);
         ServletOutputStream ouputStream = response.getOutputStream();
         ouputStream.write(byte_array, 0, byte_array.length);
         ouputStream.flush();
         ouputStream.close();
         }Any suggestion? That would be vital to me!
    Thanks in advance

    catching the JRRuntimeException and printing its stacktrace i saw that the jfree chart lib was missing.
    i put it in my libraries but now i got this error:
    java.lang.NoSuchMethodError: com.lowagie.text.pdf.PdfContentByte.transform(Ljava/awt/geom/AffineTransform;)V
         net.sf.jasperreports.engine.export.JRPdfExporter.exportText(JRPdfExporter.java:1468)
         net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:484)
         net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:448)
         net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:413)
         net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:250)
         net.sf.jasperreports.engine.JasperExportManager.exportReportToPdf(JasperExportManager.java:188)
         net.sf.jasperreports.engine.JasperRunManager.runReportToPdf(JasperRunManager.java:205)
         customer_care.servlet.Reporting.getReport(Reporting.java:77)
         customer_care.servlet.Reporting.processRequest(Reporting.java:50)
         customer_care.servlet.Reporting.doGet(Reporting.java:92)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    com.lowagie.text.pdf.PdfContentByte.transform is inside the iText library.
    I had an old version so I updated it but nothing changed.
    Any suggestion?
    Thanks

  • Date problem with jasper reports

    I need to pass the date values as a parameter to the jasper reports and process it in the report, how can achieve it please give me a brief explanation, i need the date value for processing a sql statement in the jasper report please help me a sample code
    from=first date value;
    to=second date value;
    //i need to pass the date  as the parameter how can i achieve it
          HashMap hm = new HashMap();
           hm.put("fromdate", from);
           hm.put("todate", to);
      JasperPrint jasperPrint;
                        jasperPrint = JasperFillManager.fillReport("W:/ReportWorks/Estimation Reports/Dailyreport ItemWise.jasper",hm, con);
                        JasperViewer.viewReport(jasperPrint,false); 

    HI All
    I am working on Jasper report Project and when i am filling the report through
    JasperFillManager.fillreport(String sourceFileName,Map parameters,Connection conn)
    I am getting following exception:(I have included common-collections 3.2.jar in my classpath)
    java.lang.NoClassDefFoundError: org/apache/commons/collections/ReferenceMap
         at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.<clinit>(JRAbstractJavaCompiler.java:58)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at java.lang.Class.newInstance0(Class.java:350)
         at java.lang.Class.newInstance(Class.java:303)
         at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:489)
         at net.sf.jasperreports.engine.JasperCompileManager.loadEvaluator(JasperCompileManager.java:243)
         at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:411)
         at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:418)
         at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
         at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)
         at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
         at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234)
    Please Suggest ;Thanks in advance

  • Problem with Jasper Reports

    hi evrybody... i'm having a problem while using Jasper Reports. I'm trying to Export a jrxml file generated by JasperAssistant plug-in in eclipse. but all i'm having is an exception. the following is my code and the said exception:
    CODE:
    public class DataSourceApp
    private static final String TASK_HTML = "html";
    private static final String TASK_XLS = "xls";
    private static final String TASK_CSV = "csv";
    private static final String TASK_RUN = "run";
    public static void main(String[] args)
    String fileName = null;
    String taskName = null;
    taskName = "html";
    fileName = "path\\DataSourceReport.jasper";
    try
    long start = System.currentTimeMillis();
    if (TASK_HTML.equals(taskName))
    JasperPrint jPrint = new JasperPrint();
    HashMap parameters = new HashMap();
    Connection con = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con=DriverManager.getConnection("jdbc:odbc:BOM_DSN","","");
    jPrint = JasperFillManager.fillReport("path\\DataSourceReport.jrxml", parameters, con);
    JasperExportManager.exportReportToHtmlFile(fileName);
    System.err.println("HTML creation time : " + (System.currentTimeMillis() - start));
    System.exit(0);
    catch (JRException e)
    e.printStackTrace();
    System.exit(1);
    catch (Exception e)
    e.printStackTrace();
    System.exit(1);
    EXCEPTION:
    java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
         at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:161)
         at datasource.DataSourceApp.main(DataSourceApp.java:184)
    NESTED BY :
    java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
         at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:161)
         at datasource.DataSourceApp.main(DataSourceApp.java:184)
    NESTED BY :
    net.sf.jasperreports.engine.JRException: Error loading object from file : C:\Eclipse\eclipse\workspace\test\BOM_Package\DataSourceReport.jrxml
         at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:89)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:161)
         at datasource.DataSourceApp.main(DataSourceApp.java:184)
    Caused by: java.io.StreamCorruptedException: invalid stream header
         at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:737)
         at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
         at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
         ... 2 more
    hope you can help me asap.. thanks!
    --joms                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    HI All
    I am working on Jasper report Project and when i am filling the report through
    JasperFillManager.fillreport(String sourceFileName,Map parameters,Connection conn)
    I am getting following exception:(I have included common-collections 3.2.jar in my classpath)
    java.lang.NoClassDefFoundError: org/apache/commons/collections/ReferenceMap
         at net.sf.jasperreports.engine.design.JRAbstractJavaCompiler.<clinit>(JRAbstractJavaCompiler.java:58)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
         at java.lang.Class.newInstance0(Class.java:350)
         at java.lang.Class.newInstance(Class.java:303)
         at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:489)
         at net.sf.jasperreports.engine.JasperCompileManager.loadEvaluator(JasperCompileManager.java:243)
         at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:411)
         at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:418)
         at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:77)
         at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:59)
         at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:147)
         at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:57)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234)
    Please Suggest ;Thanks in advance

  • Problem displaying PDF with Jasper Reports

    I have the following code that loads a report and displays it in PDF format:
    if(jasperReport==null) {
         logger.debug("Loading...");
         InputStream inStream = null;
         try {
              inStream = getServletContext().getResourceAsStream("/WEB-INF/reports/UnitReport.jasper");
              logger.debug("got inStream");
              jasperReport = (JasperReport) JRLoader.loadObject(inStream);
              logger.debug("Loaded compiled report");
         } catch(Exception e) {
              logger.error(e.getMessage(),e);
         } finally {
              try { inStream.close(); } catch(Exception e) {}
              logger.debug("closed");
    OutputStream outStream = null;
    Connection conn = null;
    try {
         logger.debug("Start build");
         LoginInfo lInfo = (LoginInfo) request.getSession().getAttribute("LoginInfo");
         logger.debug("got name: " + lInfo.getFullName());
         String unitID = (String) request.getParameter("unitID");
         response.setContentType("application/pdf");
         outStream = response.getOutputStream();
         logger.debug("set content type & got OutputStream");
         JRExporter exporter = new JRPdfExporter();
         logger.debug("new exporter");
         conn = DBConnection.getDBConnection();
         logger.debug("got connection");
         //Setup parameters
         Map<String, Object> params = new HashMap<String, Object>();
         params.put("unitID", new Long(unitID));
         params.put("userName", lInfo.getFullName());
         if(debug) {
              logger.debug("set parameters: ");
              logger.debug("  Unit ID:    " + unitID);
              logger.debug("  User Name:  " + lInfo.getFullName());
         JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, conn);
         logger.debug("built report");
         exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
         exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outStream);
         logger.debug("set output parameters");     
         exporter.exportReport();
         logger.debug("dumped.");
    } catch(Exception e) {
         logger.error(e.getMessage(),e);
    } finally {
         try {outStream.close(); } catch(Exception e) {}
         try {conn.close(); } catch(Exception e) {}
         logger.debug("cleanup done.");
    }This works fine locally but when I deploy the EAR file to the production server I get the following:
    [5/19/08 20:55:36:730 CDT] 00000045 SystemOut     O 20:55:36.730 DEBUG JasperReports.doGet:42 - Start
    [5/19/08 20:55:36:730 CDT] 00000045 SystemOut     O 20:55:36.730 DEBUG JasperReports.doGet:49 - reportID: randdunitreport
    [5/19/08 20:55:36:746 CDT] 00000045 SystemOut     O 20:55:36.746 DEBUG JasperReports.doGet:56 - Loading...
    [5/19/08 20:55:36:746 CDT] 00000045 SystemOut     O 20:55:36.746 DEBUG JasperReports.doGet:62 - got inStream
    [5/19/08 20:55:37:168 CDT] 00000045 SystemOut     O 20:55:37.168 DEBUG JasperReports.doGet:64 - Loaded compiled report
    [5/19/08 20:55:37:168 CDT] 00000045 SystemOut     O 20:55:37.168 DEBUG JasperReports.doGet:71 - closed
    [5/19/08 20:55:37:168 CDT] 00000045 SystemOut     O 20:55:37.168 DEBUG JasperReports.doGet:77 - Start build
    [5/19/08 20:55:37:168 CDT] 00000045 SystemOut     O 20:55:37.168 DEBUG JasperReports.doGet:85 - set content type & got OutputStream
    [5/19/08 20:55:37:246 CDT] 00000045 SystemOut     O 20:55:37.246 DEBUG JasperReports.doGet:88 - new exporter
    [5/19/08 20:55:37:246 CDT] 00000045 SystemOut     O 20:55:37.246 DEBUG JasperReports.doGet:91 - got connection
    [5/19/08 20:55:37:246 CDT] 00000045 SystemOut     O 20:55:37.246 DEBUG JasperReports.doGet:98 - set parameters:
    [5/19/08 20:55:37:246 CDT] 00000045 SystemOut     O 20:55:37.246 DEBUG JasperReports.doGet:99 -   Unit ID:    6472
    [5/19/08 20:55:37:246 CDT] 00000045 SystemOut     O 20:55:37.246 DEBUG JasperReports.doGet:100 -   User Name:  Fred Smith
    [5/19/08 20:55:37:996 CDT] 00000045 SystemOut     O 20:55:37.996 ERROR JasperReports.doGet:114 - Error loading object from URL : file:/C:/Program Files/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/MOMWEBNode01Cell/ClaimProEAR.ear/ClaimPro.
    war/WEB-INF/classes/
    net.sf.jasperreports.engine.JRException: Error loading object from URL : file:/C:/Program Files/IBM/WebSphere/AppServer/profiles/AppSrv01/installedApps/MOMWEBNode01Cell/ClaimProEAR.ear/ClaimPro.war/WEB-INF/classes/
            at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:145)
            at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:264)
            at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:308)
            at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:257)
            at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:275)
            at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:426)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1380)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:692)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
            at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:113)
            at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:895)
            at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:798)
            at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:63)
            at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
            at com.scag.claimpro.servlet.JasperReports.doGet(JasperReports.java:103)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
            at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:989)
            at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:501)
            at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:464)
            at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3252)
            at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:264)
            at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:811)
            at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1433)
            at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:112)
            at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:454)
            at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:383)
            at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:102)
            at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
            at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
            at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
            at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
            at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:195)
            at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:743)
            at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:873)
            at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)
    Caused by:
    java.io.StreamCorruptedException: invalid stream header
            at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:778)
            at java.io.ObjectInputStream.<init>(ObjectInputStream.java:291)
            at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:140)
            ... 35 more
    [5/19/08 20:55:37:996 CDT] 00000045 SystemOut     O 20:55:37.996 DEBUG JasperReports.doGet:118 - cleanup done.UnitReport contains 2 subreports and works just fine on my local server. Am I missing something here or doing something wrong...any help is greatly appreciated.
    Thanks,
    -Jeff

    How will u convert the document to PDF via XML if the document contains the chart.
    If u have done this please send the code to me on "[email protected]"
    Thanks in advance
    nitish

  • Jasper report issue report row 65535 but can't generated correctly

    Hi All ,
    We are trying to create report with jasper report . The issue is sometime generated report can be open.
    Below is test case and result .
    1.     when dummy all the returned field of procedure to ‘1’ and 20000 rows are to printed in report. The file size is 7564K. The excel can be open after several minutes waiting.
    2.     When dummy the procedure only return 5000 rows with actual data, the field type may be char, number. The file size is 2010K. The excel can be open quickly.
    3.     When dummy the procedure only return10000 rows with actual data. The file size is 3999K. The excel cannot be open.
    What the issue may be?
    Below is our code.
         * Generate the the report, currently generate excel report.
         * @param results - data set return from procedure execution
         * @param parameters - input parameters for Jasper Report design
         * @param procName - Jasper file name
         * @param outputFile - used as report file name
         * @throws JRException - Jasper exception
    private void ReportGenerator(List<ScriptParameterObject> results,HashMap<String, Object> parameters, String procName,String outputFile) throws JRException, Exception
    logger.info("Creating report: " + outputFile + ".xls");
    //URL en = ClassLoader.getSystemResource("jasper"+java.io.File.separator+procName + ".jasper");
              URL en = ClassLoader.getSystemResource(procName + ".jasper");
    if(en==null)
    throw new Exception("Can't find jasper file: " + procName + ".jasper");
    logger.debug("Loading jasper file: " + en.getPath());
    //InputStream isJasper = ClassLoader.getSystemResourceAsStream("jasper"+java.io.File.separator+procName + ".jasper");
    InputStream isJasper = ClassLoader.getSystemResourceAsStream(procName + ".jasper");
    JasperReport relatorio = (JasperReport) JRLoader.loadObject(isJasper);
              SapiData sapiData = new SapiData(results);
              logger.debug("Filling report file ..." + results.size());
    JasperPrint impressao=null;
    try{
              impressao = JasperFillManager.fillReport(relatorio,parameters, sapiData);
    catch(Exception ex){
    System.out.println(ex); ---never catch error. but not know why the .xls can't open
    if (impressao == null) {
    logger.debug("impressao == nul.");
    logger.debug("Filled report file successfully.");
              impressao.setLocaleCode(Locale.getDefault().getCountry());
              JRAbstractExporter saida = null;
              saida = new JRXlsExporter();
              saida.setParameter(JRExporterParameter.JASPER_PRINT, impressao);
              saida.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outputFile     + ".xls");
              saida.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET,Boolean.FALSE);
              saida.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND,Boolean.TRUE);
              saida.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);
              saida.setParameter(JRXlsExporterParameter.IS_COLLAPSE_ROW_SPAN,Boolean.TRUE);
              saida.setParameter(JRXlsExporterParameter.MAXIMUM_ROWS_PER_SHEET, Integer.decode("5000"));
    logger.debug("Exporting excel report file ...");
              saida.exportReport();
              logger.debug("Generated excel report file successfully: "+outputFile + ".xls");
              /* - used for generate html report
              JRAbstractExporter htmlExp = new JRHtmlExporter();
              htmlExp.setParameter(JRExporterParameter.JASPER_PRINT, impressao);
              htmlExp.setParameter(JRHtmlExporterParameter.OUTPUT_FILE_NAME,outputFile + ".html");
              htmlExp.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS,Boolean.TRUE);
              htmlExp.setParameter(JRHtmlExporterParameter.IS_WRAP_BREAK_WORD,Boolean.TRUE);
              htmlExp.exportReport();
         }

    I hava the same problem.Hava you solved it?

  • Error in running Jasper Reports for more than 100 users in stress test

    I have created a web application with Jasper reports. during the stress test, we were able to run the same report simultaneously for 100 concurrent users, after that we get the following error. I hope there is no problem in my code (correct me if i am wrong)
    We use Web Sphere
    The error we get is as follows:
    java.io.FileNotFoundException: /apps/HewittProjects/installedApps/TBIA/workforce_CUR.ear/workforceServer4.16.4.war/reports/timesheet_mgr2.jasper (Too many open files)
               at java.io.FileInputStream.open(Native Method)
               at java.io.FileInputStream.(FileInputStream.java:106)
               at com.wily.introscope.agent.probe.io.ManagedFileInputStream.(ManagedFileInputStream.java:89)
               at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:85)
               at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:64)
               at com.workforcesoftware.servlets.ReportServlet2.getCompiledReport(ReportServlet2.java:712)
               at com.workforcesoftware.servlets.ReportServlet2.doPost(ReportServlet2.java:423)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
               at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
               at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
               at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
               at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
               at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
               at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
               at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
               at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:61)
               at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1009)
               at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:529)
               at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:208)
               at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:134)
               at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:321)
               at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
               at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:120)
               at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:250)
               at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
               at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
               at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:652)
               at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:448)
               at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:937)
    NESTED BY :
    net.sf.jasperreports.engine.JRException: Error loading object from file : /apps/HewittProjects/installedApps/TBIA/workforce_CUR.ear/workforceServer4.16.4.war/reports/timesheet_mgr2.jasper
               at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:92)
               at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:64)
               at com.workforcesoftware.servlets.ReportServlet2.getCompiledReport(ReportServlet2.java:712)
               at com.workforcesoftware.servlets.ReportServlet2.doPost(ReportServlet2.java:423)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
               at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
               at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
               at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
               at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
               at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
               at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
               at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
               at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:61)
               at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:1009)
               at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:529)
               at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:208)
               at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:134)
               at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:321)
               at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
               at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:120)
               at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:250)
               at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
               at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
               at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:652)
               at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:448)
               at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:937)
    if this really cannot find the file, then how could it run successfully for 100 users?
    Have anyone experienced this problem?
    Thanks for your help.

    ummm seems odd to have 100 users making a report.. that can be the limitation of your application..

  • Trying to create a pdf with jasper - Content is not allowed in prolog

    hi all,
    Im trying to create a pdf file with jasper reports but i get this error message:
    29/11/2007 16:52:03 org.apache.commons.digester.Digester fatalError
    SEVERE: Parse Fatal Error at line 1 column 1: Content is not allowed in prolog.
    org.xml.sax.SAXParseException: Content is not allowed in prolog.
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
         at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:215)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
         at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
         at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1438)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(XMLDocumentScannerImpl.java:899)
         at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
         at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
         at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
         at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
         at org.apache.commons.digester.Digester.parse(Digester.java:1666)
         at net.sf.jasperreports.engine.xml.JRPrintXmlLoader.loadXML(JRPrintXmlLoader.java:151)
         at net.sf.jasperreports.engine.xml.JRPrintXmlLoader.load(JRPrintXmlLoader.java:103)
         at net.sf.jasperreports.view.JRViewer.loadReport(JRViewer.java:1376)
         at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:243)
         at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:214)
         at net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:140)
         at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:397)
         at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:328)
         at br.com.abril.contratos.Gerar.geraRelatorio(Gerar.java:38)
         at br.com.abril.contratos.Gerar.main(Gerar.java:47)

    cause of the error:
    After some extensive research on the web, it is found that that you are using an UTF-8 encoded file with byte-order mark (BOM). Java doesn't handle BOMs on UTF-8 files properly, making the three header bytes appear as being part of the document. UTF-8 files with BOMs are commonly generated by tools such as Window's Notepad. This is a known bug in Java, but it still needs fixing after almost 8 years...
    There are some hexadecimal character at the begining of the file, which is giving error"content not allowed in prolog". No solution is provided for this till now.
    Example: suppose your file start with <?xml version="1.0" encoding="utf-8"?>. you will see this in a editor. But if you open this file with any hexadecimal editor you will find some junk character in the start of the file.that is causing the problem
    solution:
    1) convert your file into a string and then read the file from the forst character that in my case the first character will be "<".so the junk character will not be there in the string and then again convert it into a file.
    2) some people are able to solve this problem by changing the "utf-8" to "utf-16". remember only in some case. some times this problem also exits in "utf-16" file.
    3) some are able to solve this problem by changing the LANG to US.en.
    4) If the first three bytes of the file have hexadecimal values EF BB BF then the file contains a BOM.so you can also handle by your own.
    5)Download a hexadecimal editor and remove the BOM.
    6) In case you are not able to think furthe then please to more research in internet may be you find some other solution to this problem. But These solution are some type of hack not exactly a solution.

  • Trying to generate a pdf with jasper

    Fellas,
    i hav trying to generate a pdf with jasper reports, but i cant. I create a file .jasper with iReports. This is my code:
    emite.java
    package utilitarios;
    //import net.sf.jasperreports
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.view.JasperViewer;
    import java.sql.*;
    import java.util.*;
    import javax.swing.*;
    import java.util.HashMap;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class emitebl {
    private static Connection getConnection( ) throws ClassNotFoundException, SQLException{
    String driver = "org.postgresql.Driver";
    String url = "jdbc:postgresql://localhost/sist";
    String user = "usuario";
    String password = "";
    Class.forName(driver);
    Connection con = DriverManager.getConnection( url, user, password );
    return con;
    public void geraRelatorio( ) throws JRException, Exception{
    Connection con = getConnection( );
    Statement stm = con.createStatement( );
    String query = "SELECT * FROM emissaobl WHERE id=4";
    ResultSet rs = stm.executeQuery(query);
    JRResultSetDataSource jrRS = new JRResultSetDataSource(rs);
    Map parameters = new HashMap();
    JasperFillManager.fillReportToFile("emitebl.jasper",parameters,jrRS);
    JasperExportManager.exportReportToPdfFile("emitebl.jrprint");
    JasperViewer.viewReport("emissao_bl.pdf",false);
    }emissao.jsp:
    <%@ page import="utilitarios.*" %>
    <%
    new emitebl().geraRelatorio();
    %>Following the error message exception:
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: emitebl.jasper
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
    org.apache.jsp.emissaobl.exportapdf_jsp._jspService(exportapdf_jsp.java:76)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    root cause
    net.sf.jasperreports.engine.JRException: emitebl.jasper
    net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:73)
    net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:270)
    utilitarios.emitebl.geraRelatorio(emitebl.java:37)
    org.apache.jsp.emissaobl.exportapdf_jsp._jspService(exportapdf_jsp.java:54)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)where i hav to put the .jasper file?

    import java.io.*;
    import java.net.*;
    import java.sql.*;
    import java.util.*;
    import java.sql.*;
    import java.io.File;
    import java.util.Date;
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.view.JasperViewer;
    class dbAccessi
              public static void main (String args []) throws SQLException
                        try{
                             //DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
                                       Class.forName ("oracle.jdbc.driver.OracleDriver");
                             Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@10.236.8.49:1521:heb","hebuser","hebpass");
         // @machineName:port:SID, userid, password
                                       int i=0,j=0;
                             Statement stmt = conn.createStatement();
                             ResultSet rs = stmt.executeQuery("select age,name from java1");
                                       while (rs.next())
                                  System.out.println (rs.getString(1));
                                  System.out.println (rs.getString(2));
                                  JRResultSetDataSource jrRS = new JRResultSetDataSource(rs);
                                            Map parameters = new HashMap();
                                            JasperFillManager.fillReportToFile("newone.jasper",parameters,jrRS);
                                            JasperExportManager.exportReportToPdfFile("emitebl.jrprint");
                                            JasperViewer.viewReport("emissao_bl.pdf",false);
                                       rs.close();
                                       stmt.close();
                   conn.close();
                             catch(Exception e)
                                  e.printStackTrace();
    for the above given code, I got error message when i run the code as a standalone in cmd prompt and the jasper file specified(may be error occured in .jasper file) could please send the req jasper file to load it.
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lo
    gging/LogFactory
    at net.sf.jasperreports.engine.fill.JRFillDataset.<clinit>(JRFillDataset
    .java:72)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.jav
    a:443)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFi
    ller.java:92)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFi
    ller.java:74)
    at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:
    113)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:83
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillMa
    nager.java:428)
    at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(Jasper
    FillManager.java:319)
    at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(Jasper
    FillManager.java:275)
    at dbAccessi.main(dbAccessi.java:30)
    thanks in advance

  • Jasper reports generation

    Hi, All
    Iam already generated pdf and excel reports.My problemis that i have to generate reports between the startDate to endDate.I have two inputdate calenders one for startDate and another for endDate.Iam using JSF.how can i generate pz anybody help.
    Thanks on advance

    You should probably find a forum that deals with Jasper Reports, this one is not it.

  • Jasper Reports Application Deployment to Oracle

    Hello everyone,
    I am deploying my project with jasper reports application to oracle. I have placed the jasperreports jar to .../10.1.3/j2ee/home/applib. When I do that I discovered that the commons-logging-1.0.2.jar of jasper is having conflict with oracle used commons-logging.jar. What is the best way to resolve this?
    For the mean time, I edited the server.xml so that only the jasper jar wil be loaded and I can see if my application is working. I does loads and executes but encounters the ff. errors:
    09/01/28 20:56:12 net.sf.jasperreports.engine.JRException: Error loading
    expression class : CashCollectionPrint_1226914856343_228291
    Is it because my application doesn't have a policy grant to load class files? I have checked the jazn.xml files and i don't know how to add policy grant. If that is really what's causing the jasper error, can anyone help me on giving my application a grant to load class files?
    Here are my environment details:
    Jasper reports version 2.0.4
    OS: Linux x86 (32 bit)
    DB: 10g R2
    The server instance is RUP6
    Thank you so much and I hope you can guide me in deploying my application.
    Rgs,
    Ish
    Edited by: user10226882 on Jan 29, 2009 9:36 AM

    This is the oracle reports forum. If you need information about jasper-reports you should post the question in an appropiate forum.

  • Beginner trying to use Jasper Reports

    Hi,
    I am a beginner in implementing report generation. I want to use Jasper reports to convert my xml to pdf using the ireport plugin in Netbeans
    Presently i have an input xml, i do not want to make an JDBC connection or an database connection, i am using another tool to generate xml output from the database.
    i get my input xml and i want to convert into pdf, is there any way to do that??
    thanks a lot

    You should probably find a forum that deals with Jasper Reports, this one is not it.

Maybe you are looking for

  • Snow Blizzard looks like "Eyes" on monitor.

    Hi, I'm hoping someone can help. I'm new to Motion and am working on a project with the Snow Blizzard, Particle Emitter. On the computer monitor the effect works fine and appears as I have hoped. However, when I export the clip to a quicktime movie a

  • RE: Bookmarking; can you link to an external pdf file?

    Hi, I apologize in advance if this question is stupid; I am very new to using Adobe Acrobat 7 and have not had any training using it, much less creating documents, extracting, linking, etc. My employer creates PDF files of different documents, then w

  • TS3694 When emptying trash I get error code -8003.  Anyone know what the problem is?

    When emptying trash I get error code -8003.  When I get this error I am trying to delete downloaded softeare.  Typical file deletion works okay. This is on an iMAC.  Don't knwo why I cannot pick an iMAC community below. Leparker46

  • How to Trace ABAP Webdynpro Application?

    Dear Friends, We are trying analyse performance bottle neck for ABAP Webdynro application. We have an Webdynpro Application named Z_APPLICTION_URL in NW 7.0 SP16 which is calling 4 RFC's in R/3 4.7 to fech data. Users lauch this application using URL

  • Music Videos - have sound but video does not play in windows 7

    I have windows 7 and the latest version of Itunes. Most everything seems to be working ok, but when i try to play a music video i get the sound ok, but the video never starts, it just seems to stay on the first screen shot and never changes, even whe