Jump to content
Changes to the Jaspersoft community edition download ×

gordonb

Members
  • Posts

    7
  • Joined

  • Last visited

gordonb's Achievements

Rookie

Rookie (2/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. Lucian, Your comments about classpaths and the need to ensure commons-logging was included were helpful. After making sure all those commons-*.jar files WERE in the class path I still got the error. Eventually a google search on the name of the class that was not defined (Lorg/apache/commons/logging/Log), which is not included in the commons-logging jar, led me to a helpful comment about the Sun Java Server. Although the reference was to version 8.2 this fix also worked with the durrent distribution of the Sun Glassfish server (v2.1 (9.1.1) (build b60e-fcs)) *********** (borrowed from http://www.dreamincode.net/forums/showtopic76527.htm) The problem was with Sun App Server 8.2 as it ships with its own copy of the digester API. Unfortunately it ships with the older version that does not have the "setSubstitutor" method. In order to resolve this issue one needs to add the following definition in the sun-web.xml file. <class-loader delegate="false" /> This will use the API version that is bundled with your applcaition. *********** after making this change in the configuration file, the PDF reports work correctly. This might be a useful FAQ Thanks again for your help, and for such a nice product. Bill Gordon
  2. Thank you, Lucian, for your suggestion. When I moved the return statement out of the finally block I did see an error message: Caused by: javax.faces.FacesException: #{ReportPage.btnReportPdf_action}: java.lang.NoClassDefFoundError: Lorg/apache/commons/logging/Log; I added the commons logging jars to the Netbeans dev. environment and referenced them in the project, but after that I am still getting the same error message. Any further suggestions? Thanks again Bill
  3. To do this, you can put the .jasper files in a source directory in your app, and reference them via their relative path. Try a few examples creating a file with various relative paths to see how to do this. (Files with a filename but no path tend to end up in the domain1/config folder; work backwards from that location.)
  4. Some more information: developed in NetBeans 6.1 nd also Netbeans 6.5; running in Glassfish 2, under OS X.4 and Windows XP with latest SP
  5. In my application, I want to use JasperFillManager.fillReport to fill a pre-compiled .jasper report and save the result as a PDF file, which the user can view and/or download. In an Apple OS X environment this works fine. In a Windows XP or Windows 2003 server environment the same code does not fill the report AND does not throw an error. Can anyone help? Here is the code I am using, where jasperIn is the name of the .jasper report file, conn is the appropriate database connection, and HashMap contains the parameters needed for the report. The instance variable pdf, a String, is used to display status and error messages in the main application. After this routine completes, the value of pdfMessage is: report file = E:JasperReportsPT2DemoBrandsByName.jasper exists; lines 1; 9; This message indicates that the call to fillReport failed and jumped directly to the finally block without throwing either a JRException or a plain vanilla Exception. public static Long savePdfReportAsFile(String jasperIn, String pdfOut, Connection conn, HashMap parameters) { pdfMessage = (new File(jasperIn).exists() ? "exists" : "does not exist"); Long ret = new Long(-99); try { pdfMessage = "report file = " + jasperIn + " " + pdfMessage + "; lines 1; "; // for debug JasperPrint jPrint = JasperFillManager.fillReport(jasperIn, parameters, conn); pdfMessage += "2; "; // for debug if (jPrint == null) { ret = new Long(-101); return (ret); } JasperExportManager.exportReportToPdfFile(jPrint, pdfOut); f = new File(pdfOut); if (!f.exists()) return (new Long(-102)); ret = f.length(); } catch (JRException e) { pdfMessage += "8a"; // for debug String s = e.getMessage(); System.out.println(s); ret -= 100; } catch (Exception e) { String s = e.getMessage(); System.out.println(s); ret -= 100; pdfMessage += "8b; "; // for debug } finally { pdfMessage += "9; "; // for debug return (ret); } }
  6. I created a directory on the server, but not in the context of the application, e.g. E:Jasper. I then put all report files in this directory and reference it by an absolute path. This way a report designer can develop reports and post them for use easily.
  7. I have an application for which I want to provide some PDF reports via JasperReports. I have developed and compiled (to .jasper files) the reports in both the Mac and Windows environments. Both types work fine when I run them in my Mac development environment, but when I deploy the app and reports to the production Windows java server, JasperReports does not fill the PDF files and there are no error conditions in the server log. I get the same behavior when I try to generate a report displaying data via an embedded query, or when I try to generate a dummy report using a JREmptyDataSource. I guess I might be missing a config setting or library; can someone please help? ********************************************************************************** Development environment: OS X 10.4; Netbeans 6.1 with current version of iReport plugin; Glassfish v2ur2 Windows dev environments for reports: XP SP4, current version of iReport Production environment: Windows 2003 Server SP2; latest version of Glassfish server (Sun GlassFish Enterprise Server v2.1 (9.1.1) (build b60e-fcs)) The .jasper reports are stored in a folder in a known location; they have embedded sql queries; and they are processed by the following method, where jasperIn is the full pathname of the .jasper compiled report file; pdfout is the name of a file in which the filled report will be stored; conn is the database connection for the embedded sql query; and params holds query parameters: public static Long savePdfReportAsFile(String jasperIn, String pdfOut, Connection conn, HashMap params) { pdfMessage = null; Long ret = new Long(-99); try { JasperPrint jPrint = JasperFillManager.fillReport(jasperIn, params, conn); JasperExportManager.exportReportToPdfFile(jPrint, pdfOut); File f = new File(pdfOut); ret = f.length(); } catch (Exception e) { String s = e.getMessage(); System.out.println(s); pdfMessage = s; ret -= 100; } finally { return (ret); } } When I call this method on the Windows server the rsults are: ret = -99; pdfMessage is null In the Mac environment, ret > 0 is the size of the pdf file; pdfMessage is null; and the pdf file is properly generated.
×
×
  • Create New...