Jump to content
We've recently updated our Privacy Statement, available here ×

burferd

Members
  • Posts

    87
  • Joined

  • Last visited

 Content Type 

Profiles

Forum

Events

Featured Visualizations

Knowledge Base

Documentation (PDF Downloads)

Blog

Documentation (Test Area)

Documentation

Dr. Jaspersoft Webinar Series

Downloads

Everything posted by burferd

  1. I'm bringing this up again since I did not recieve any feedback on my last post. I have added jrxml version of the report I am attempting to run as an attachment. I have also included the code I am using to create the report in my application. The report gives the exception noted in my last post when it attempts to create the report in the following line of code: jp = JasperFillManager.fillReport( sb1.getReportDir()+"Company_Report.jasper", parameters, conn ); The error message is: "cannot assign instance of net.sf.jasperreports.engine.base.JRBaseStaticText to field net.sf.jasperreports.engine.base.JRBaseLineBox.boxContainer of type net.sf.jasperreports.engine.JRBoxContainer in instance of net.sf.jasperreports.engine.base.JRBaseLineBox" I do not understand how the report can run in iReport, but have problems in the application. Maybe there is a missng library? Here are the libraries I am linking to in the application: commons-beanutils-1.8.0.jar commons-collections-2.1.1.jar commons-digester-1.7.jar commons-logging-1.0.4.jar iText-2.1.0.jar jasperreports-3.6.0.jar jfreechart-1.0.12.jar poi-3.2-FINAL-20081919.jar I'm at a standstill until I can figure out what the problem is here. Any help is appreciated Thanks. Code: public boolean createCompanyRpt() { JasperPrint jp=null; JasperReport jr = null; try { String title = "Tag Enrollment Report"; Map parameters = new HashMap(); String dir = sb1.getReportDir(); jp = JasperFillManager.fillReport( sb1.getReportDir()+"Company_Report.jasper", parameters, conn ); if( doPdf )doPdfReport( jp, "CompanyReport"); if( doExcel )doExcelReport( jp, "CompanyReport" ); } catch( Exception e ) { e.printStackTrace(); log( "<ReportSessionBean.createCompanyRpt> Error: "+ e.toString()); sb1.setMessage( "Error creating report."); return false; } return true; }
  2. I'm using JasperReports 3.6.0 and iReport 3.5.3, NetBeans6.5.1 and Glassfish 2.0 I have a report that works fine in iReport, but when I attempt to run it from my application, I get the following exception when calling the JasperFillManager.fillReport() method to create the report: "cannot assign instance of net.sf.jasperreports.engine.base.JRBaseStaticText to field net.sf.jasperreports.engine.base.JRBaseLineBox.boxContainer of type net.sf.jasperreports.engine.JRBoxContainer in instance of net.sf.jasperreports.engine.base.JRBaseLineBox" It kind of sounds like something in the report itself is trying to use the wrong type of component, but I know virtually nothing about Jasper Reports. Does anyone have an idea what is causing this? Let me know if I need to post any additional information or code. Thanks.
  3. I found the problem. I had to add commons_logging-1.0.2.jar to the rest of the libraries I had for JasperReport 1.3.2 Still no clue why the original project worked without this library and the new one didn't.
  4. Using NetBeans6.5.1, Glassfish 2, JasperReports1.3.2 I have an old JSF project that creates reports just fine. I am creating a new JSF application and migrate to the later version of Jasper reports. My first step was to attempt to migrate the code from the project that works and test the reports that work. To that end, I copied my report session bean to the new project and tried to run a simple test report that has no database access. I'm using the same server for both projects, so I can't see how it would be a server configuration issue. I am using the same jar files in the libraries for both projects (at least the library manager says they are being used for both); commons-beanutils-1.7.jar, commons-collections-2.1.jar, commons-digester-1.7.jar, itext-1.3.2.jar, jasperreports-1.3.2.jar, jfreechart-1.0.0.jar, poi-2.0-final-20040126.jar Here is the code I am using to create the test report - it is the same in both applications: public boolean createTestRpt() { JasperPrint jp=null; JasperReport jr = null; try { String title = "Title"; Map parameters = new HashMap(); String rptFile = "C:/Reports/JasperReports/EVR/NoDbTest.jasper"; jp = JasperFillManager.fillReport( rptFile, parameters, new JREmptyDataSource() ); doPdfReport( jp, "EnrollmentReport"); } catch( Exception e ) { log( "<SessionBean1.createEnrollmentRpt> Error: "+ e.toString()); sb1.setMessage( "Error creating report."); return false; } return true; } public void doPdfReport( JasperPrint reportout, String filename ) { byte[] pdf =null; try { pdf = JasperExportManager.exportReportToPdf(reportout); } catch (JRException ex3) { error("Couldn't create PDF: "+ex3); } FacesContext faces = javax.faces.context.FacesContext.getCurrentInstance(); HttpServletResponse response =(HttpServletResponse)faces.getExternalContext().getResponse(); response.setContentType("application/pdf"); response.setContentLength(pdf.length); response.setHeader("Content-disposition","attachment; filename=\""+filename+".pdf\""); ServletOutputStream out; try{ out = response.getOutputStream(); out.write(pdf); }catch (Exception qw){ error("Could not output file:"+qw); } faces.responseComplete(); } Like I said, the original works just fine. However, the new version throws a page error (not a java exception trapped by the catch block) when executing JasperManager.fillReport() (in bold) line of the code. Here is the error message that is printed in the browser: com.sun.rave.web.ui.appbase.ApplicationException: #{LoginPage.button1_action}: java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory Does anyone have a clue why the report would work in one project, but not the other when using the same report, same browser and same code? I suspect it would have to be some kind of configuration issue, but I have no clue where to start looking. Is there another library that I need to load? Post Edited by burferd at 09/02/2009 18:05
  5. Using JasperReports 1.3.2, Glassfish 2, NetBeans 6.5 I have a web application that I am trying to create a jasper report with. The report runs in iReport, and the basic java code logic for creating the report works on a different system. When I attempt to execute the JasperFillManager.fillReport() method to create the report, I get the following error: at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.fill.JRBaseFiller at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at com.sun.errorhandler.ExceptionHandler.displayMessage(ExceptionHandler.java:196) at com.sun.errorhandler.ExceptionHandler.generateResponse(ExceptionHandler.java:165) at com.sun.errorhandler.ExceptionHandler.doPost(ExceptionHandler.java:112) at javax.servlet.http.HttpServlet.service(HttpServlet.java:738) at javax.servlet.http.HttpServlet.service(HttpServlet.java:831) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411) ... 26 more ----- Root Cause ----- java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.fill.JRBaseFiller at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) Below is the java code to create the report. I suspect it is something to do with my environment, I have the following set in my glassfish server.policy file: // Permissions for Jasper Reports grant { permission java.lang.RuntimePermission "createClassLoader"; permission java.lang.RuntimePermission "getProtectionDomain"; permission java.lang.RuntimePermission "modifyThreadGroup"; permission java.lang.RuntimePermission "modifyThread"; permission java.lang.RuntimePermission "accessDeclaredMembers"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; }; Thanks Code: JasperPrint jp=null; JasperReport jr = null; sb1.setSelectedDate1("05/01/2009"); sb1.setSelectedDate2("06/01/2009"); String s1 = sb1.getSelectedDate1(); String s2 = sb1.getSelectedDate2(); if( !checkRptDateFields( s1, s2, false ) )return false; if( licPlate == null )licPlate = ""; licPlate = licPlate.toUpperCase(); String image = sb1.getReportDir()+"Capture.jpg"; String title = "Title"; try { Map parameters = new HashMap(); parameters.put("p_title", title ); parameters.put("p_image", image); parameters.put( "p_start", startDate ); parameters.put( "p_end", endDate ); parameters.put( "p_tagid", tagId); parameters.put( "p_lp", licPlate); int k = sb1.getInt( vehicleStatus, 0 ); parameters.put( "p_vehstatusId", new Integer(k)); k = sb1.getInt( tagStatus, 0 ); parameters.put( "p_tagstatusId", new Integer(k)); k = sb1.getInt( vehicleType, 0 ); parameters.put( "p_vehTypeId", new Integer(k)); String s = sb1.getReportDir(); jp = JasperFillManager.fillReport( sb1.getReportDir()+"Rpt_VehEnrlmtByDocDate_131.jasper", parameters, conn ); if( doPdf )doPdfReport( jp, "VehicleEnrollmentReport"); if( doExcel )doExcelReport( jp, "VehicleEnrollmentReport" ); } catch( Exception e ) { String s = e.getMessage(); log( "<SessionBean1.createVehicleEnrollRpt> Error: "+ e.toString()); sb1.setMessage( "Error creating report."); return false; }
  6. When I created the library for 1.3.2, I had to include the following libraries: comons-beanutils-1.7.jar commons-collections-2,1,jar itext-1.3.1.jar jasperreports-1.3.2.jar jfreechart-1.0.0.jar poi-2.0-final-20040126.jar I found these in the iReport directory whn I loaded iReport 1.3.2. It looks like the jasperreports-3.5.2.jar file replaces jasperreports-1.3.2.jar, but what to I use for the other jar files? There is no lib directory in the iReport 3.5.2 directory. Where can I find the rest? Thanks
  7. The file on the download site is not good. It downloads as 95KB rather than 2.5MB
  8. Uning NetBeans 6.5. I had an old JasperReports library for Jasperreports 1.3.2. I am trying to update my NetBeans IDE to use the JasperReports 3.5.2 libraries. I created a new JasperReportLibrary in NetBeans and linked it to the jasperreports-3.5.2.jar file that I downloaded from the JasperReports download site. Unfortunately, when I restart NetBeans, I get an error that says there is an error opening jaspereports-3.5.2.jar. I have 2 questions. 1) Is this the jar file I should be using to resolve the java jasper reports references like JasperFillManager 2) How can I add the library to NetBeans in order to resolve the jasper report references? I also tried adding the plugins, but that did not seem to make any difference either, I still have the unresolved variables. Thanks
  9. Using Jasper Reports 1.3.2, Windows XP. In a JSF web application. This report used to work fine, but a minor modification was made and now I get an error. I have a report named Payroll_new.jasper. I call JasperFillManager.fillReport( reportSource, parameters, conn ); with reportSource pointing to the Payroll_new.jasper file. The parameters and database connection are valid. I get an exception from JasperFillManager.fillReport Error loading expression class : Payroll_new_1197985302937_990955"
  10. Finally got a chance to change the code to print the full stack dump. It looks like we had a problem constructing the path to the .jasper file. Thanks for the assist.
  11. FYI, I found out how to do it. Substitute doPdfReport with this. Code: public void doPdfFile( JasperPrint reportout, String filename ) { byte[] pdf =null; String file = sb1.getReportDirOut()+filename+".pdf"; try { JasperExportManager.exportReportToPdfFile(reportout, file); } catch (JRException ex3) { error("Couldn't create PDF: "+ex3); }
  12. Using JasperReports 1.3.2 I need to print my PDF report directly to a file rather than displaying the dialog box that asks you to view or save. I suspect it may be a parameter setting somewhere, but to not know what to set and where. Here is the code I use to create the report Code: public boolean createTagInfoRpt() { JasperPrint jp=null; JasperReport jr = null; try { String title = "Tag Information Report"; Map parameters = new HashMap(); parameters.put( "p_title", title ); jp = JasperFillManager.fillReport( sb1.getReportDir()+"rpt_tag_info.jasper", parameters, conn ); doPdfReport( jp, "TagInfoReport"«»); } catch( Exception e ) { log( "<SessionBean1.createTagInfoRpt> Error: "+ e.toString()); sb1.setMessage( "Error creating report."«»); return false; } return true; } And here is the code I use to create the report file. Code:[code] public void doPdfReport( JasperPrint reportout, String filename ) { byte[] pdf =null; try { pdf = JasperExportManager.exportReportToPdf(reportout); } catch (JRException ex3) { error("Couldn't create PDF: "+ex3); } FacesContext faces = javax.faces.context.FacesContext.getCurrentInstance(); HttpServletResponse response =(HttpServletResponse)faces.getExternalContext().getResponse(); response.setContentType("application/pdf"«»); response.setContentLength(pdf.length); response.setHeader("Content-disposition","attachment; filename=""+filename+".pdf""«»); ServletOutputStream out; try{ out = response.getOutputStream(); out.write(pdf); }catch (Exception qw){ error("Could not output file:"+qw); } faces.responseComplete(); }
  13. Using jasper reports 1.3.2, JSF, Java Studio Creator2_1, Sun App server 8.2, Windows Xp. Reports used to run, but now I am getting [#|2007-11-05T17:06:53.421-0600|INFO|sun-appserver-pe8.2|javax.enterprise.system.container.web|_ThreadID=16;|WebModule[/EVR]<SessionBean1.createViolationRpt> Error: net.sf.jasperreports.engine.JRException: Error loading expression class : rpt_violation_1192461308198_349867|#] The report name I pass in code is rpt_violation.jasper. I suspect the numeric suffix is something that is generated, but why? I have the following in my server.policy file // Basic set of required permissions for jasper reports grant { permission java.lang.RuntimePermission "createClassLoader.*"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; permission java.lang.RuntimePermission "accessDeclaredMembers"; permission java.lang.RuntimePermission "getProtectionDomain"; }; Do I need additional permissions or is something else wrong?
  14. Just as an FYI. The solution you suggested, removng the javaflow jar file, works. For some reason, when I removed it from my library list, it still got added to the war file. When I removed it from the war file, the reports print. Thanks.
  15. I removed the reference to jasperreports-1.3.2-javaflow.jar from my library, did a clean and build for the project and I still get the same error. I created a simple report that just displays a text field. It takes no parameters and no database connection. This also gives the same error. Here is how I am calling the test report. public boolean createTestRpt() { JasperPrint jp=null; JasperReport jr = null; try { Map parameters = new HashMap(); jp = JasperFillManager.fillReport( "C:/Reports/NoDbTest, parameters, new JREmptyDataSource() ); doPdfReport( jp, "Testrt"); } catch( Exception e ) { log( "<SessionBean1.createTestReport> "+ e.toString()); return false; } return true; } It still fails in JasperFillManager.fillReport.
  16. I have both the mentioned jar files. I have the following jar files in library list jasperreports-1.3.2-javaflow.jar jasperreports-1.3.2.jar commons-beanutils-1.7.jar commons-collections-2.1.jar commons-digester-1.7.jar itext-1.3.1.jar jfreechart-1.0.0,jar poi-2.0-final-20040126.jar Maybe there is a conflict between some of these and only one project strikes a nerve?
  17. Using Jasper Reports 1.3.2 in JSF web application. I have two projects that use reports. One works fine The other gives a NoClassDefFoundError when I call JasperFillManager.fillReport( rptPath, parameters, conn) Unfortunately, there is no reference to what is causing the problem other than something in fillReport() The reports work fine in iReport 1.3.2, so the stored procedure and report logic seems to be working. The server and IDE are configured properly, since one works. The question is why the other does not work. I have no idea what the NoClassDefFoundError is referring to in this context. Usually it is a missing method in a library somewhere, but I am calling fillReport in both cases. Here is a bit of the code I am using: public boolean createDocumentRpt( int docId ) { JasperPrint jp=null; JasperReport jr = null; try { String title = "Document Report; Map parameters = new HashMap(); parameters.put( "p_title", title ); jp = JasperFillManager.fillReport( "C:/Reports/report.jasper", parameters, conn ); doPdfReport( jp, "DocumentReport"); } catch( Exception e ) { log( "<SessionBean1.createDocumentRpt> Error: "+ e.toString()); return false; } return true; } The connection conn is the one used in the rest of the application and seems to work fine. Here is a portion of the error: Description: An unhandled exception occurred during the execution of the web application. Please review the following stack trace for more information regarding the error. Exception Details: java.lang.NoClassDefFoundError org/apache/commons/javaflow/bytecode/Continuable Possible Source of Error: Class Name: java.lang.ClassLoader File Name: ClassLoader.java Method Name: defineClass1 Line Number: -2 Source not available. Information regarding the location of the exception can be identified using the exception stack trace below. Stack Trace: java.lang.ClassLoader.defineClass1(ClassLoader.java:-2) java.lang.ClassLoader.defineClass(ClassLoader.java:620) java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1798) org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:910) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1375) org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1239) java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319) net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402) net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:234) evr.ReportSessionBean.createDocumentRpt(ReportSessionBean.java:186) evr.DocumentRptPage.submitBtn_action(TagInfoRptPage.java:581) sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke(Method.java:585) com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126) com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72) com.sun.rave.web.ui.appbase.faces.ActionListenerImpl.processAction(ActionListenerImpl.java:57) javax.faces.component.UICommand.broadcast(UICommand.java:312) Post edited by: burferd, at: 2007/10/15 17:36
  18. Thanks, That explains why I got different behavior on two different machines.
  19. This is very important to my application. It makes the difference as to whether or not I can use Jasper. I went to the link, but it was not obvious how to post a new request. How do I add a future request?
  20. That appears to work in my development environment. Still need to check in deployed client-server environment, but i suspect that will work also. Thanks. The 'vnd-ms.excel' was from an example I managed to find. I have no clue as to what it signifies.
  21. It looks like you are executing a command to run your pdf viewer on the system that is running the application. This is a JSF application, and I need to run this on the client, not the server.
  22. I am generating an excel spread sheet report and when I get the prompt to open or save, if I pick 'Open', the output is generated in my application browser window rather than in a separate browser or excel itself. How do I get the output generated either in excel or at least in a new browser window? Here is the code that I use to generate the excel output from a JasperPrint object. Code: public String doExcelReportView( JasperPrint reportout, String filename ) { result = "Ok"; FacesContext faces = javax.faces.context.FacesContext.getCurrentInstance(); HttpServletResponse response =(HttpServletResponse)faces.getExternalContext().getResponse(); JRXlsExporter exporter = new JRXlsExporter(); ByteArrayOutputStream xlsReport = new ByteArrayOutputStream(); try{ exporter.setParameter(net.sf.jasperreports.engine.JRExporterParameter.JASPER_PRINT, reportout); exporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_DETECT_CELL_TYPE, java.lang.Boolean.TRUE); exporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, java.lang.Boolean.FALSE); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, xlsReport); exporter.exportReport(); }catch (JRException jex){ result = "Couldn't complete xls export:"+jex.getMessage(); return result; } byte[] bytes = xlsReport.toByteArray(); response.setContentType("application/vnd.ms-excel"«»); response.setContentLength(bytes.length); response.setHeader("Content-disposition","attachment; filename=""+filename+".xls""«»); try{ ServletOutputStream ouputStream = response.getOutputStream(); ouputStream.write(bytes, 0, bytes.length); ouputStream.flush(); ouputStream.close(); }catch (Exception ioex){ result = "Couldn't complete xls export:"+ioex.getMessage(); } faces.responseComplete(); return result; }
  23. Bringing this up again, just in case. Can anyone definitely tell me if Jasper Reports has ANY mechanism for inserting formulas into cells in an Excel spread sheet? If not, can anyone suggest a java compatible reporting software that does?
  24. Bringing this up again, just in case. Can anyone definitely tell me if Jasper Reports has ANY mechanism for inserting formulas into cells in an Excel spread sheet? If not, can anyone suggest a java compatible reporting software that does?
  25. This should be an easy question to anyone who does reports frequently. I have a report that I am currently grouping on the "table" band. Under 'Group properties' I have the 'Group Expression' set to a field that is coming back from the database. This works fine, but I need to have the grouping be caused by either of two fields that come back from the database. How do I group by a change in more than one field? Thanks
×
×
  • Create New...