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

lepiyao

Members
  • Posts

    1
  • 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 lepiyao

  1. Hi, I'm always getting this exception 'javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/apache/commons/beanutils/NestedNullException' and the root cause 'java.lang.ClassNotFoundException: org.apache.commons.beanutils.NestedNullException' , everytime i run my function on my backing bean. And on the Console Log on my eclipse, it shown that 'JRBeanCollectionDataSource' that cause this exception. I'm using a simple commandButton (with ajax="false") in my.xhtml file to trigger the function on my backing bean. Any solution for this ? public void printPDF() throws JRException, IOException { List<PersonTest> dataSource = new ArrayList<>(); dataSource.add(new PersonTest("Tester","One")); dataSource.add(new PersonTest("Asdsa","Two")); dataSource.add(new PersonTest("Wasdsaw","Three")); String filename = "names.pdf"; String jasperPath ="/resources/report/report.jasper"; this.pdf(null, jasperPath, dataSource, filename); } public void pdf(Map<String, Object> params, String jasperPath, List<?> dataSource, String fileName) throws JRException, IOException { String relativeWebPath = FacesContext.getCurrentInstance().getExternalContext().getRealPath(jasperPath); File file = new File(relativeWebPath); JRBeanCollectionDataSource source = new JRBeanCollectionDataSource(dataSource, false); JasperPrint print = JasperFillManager.fillReport(file.getPath(), params, source); HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); response.addHeader("Content-disposition", "attatchment;filename=" + fileName); ServletOutputStream stream = response.getOutputStream(); JasperExportManager.exportReportToPdfStream(print, stream); FacesContext.getCurrentInstance().responseComplete(); }[/code]
×
×
  • Create New...