burferd Posted September 2, 2009 Share Posted September 2, 2009 Using NetBeans6.5.1, Glassfish 2, JasperReports1.3.2I 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.jarHere 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/LogFactoryDoes 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 Link to comment Share on other sites More sharing options...
burferd Posted September 2, 2009 Author Share Posted September 2, 2009 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.2Still no clue why the original project worked without this library and the new one didn't. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now