Hello,
I'm trying to save the reports (actually letters sent to customers) generated with jasperReports to a file in the server. That is, after the user clicks on the button 'Generate Letters', the pdf is sent back to the browser AND i also want to save a copy. Here's my code so far, in the handleRequestInternal method of a subclassed AbstractForm:
With this code, i get this stack trace:Code:String ids = request.getParameter(Constants.DATAGRID_SELECTION_PARAMETER); HashMap modelo = new HashMap(); modelo.put("ids","(" + ids + ")"); DataSource ds = (DataSource)getApplicationContext().getBean("dataSource"); JasperReport jr = (JasperReport)JRLoader.loadObject(getServletContext().getRealPath("/") + "/reports/cartaAlta.jasper"); JasperPrint print = JasperFillManager.fillReport(jr, modelo, ds.getConnection()); JasperExportManager.exportReportToPdfFile(print,"cartas.pdf"); return new ModelAndView("cartaAltaView",modelo);
And this is the view definition:Code:[ERROR] DispatcherServlet - -Could not complete request <org.springframework.web.util.NestedServletE xception: Handler processing failed; nested exception is java.lang.StackOverflowError: null>org.spri ngframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lan g.StackOverflowError: null java.lang.StackOverflowError at java.lang.StringBuffer.<init>(StringBuffer.java:126) at java.util.Locale.toString(Locale.java:466) at java.lang.String.valueOf(String.java:2013) at java.lang.StringBuffer.append(StringBuffer.java:365) at java.util.AbstractMap.toString(AbstractMap.java:562) at java.lang.String.valueOf(String.java:2013) at java.lang.StringBuffer.append(StringBuffer.java:365) at java.util.AbstractMap.toString(AbstractMap.java:562) at java.lang.String.valueOf(String.java:2013) at java.lang.StringBuffer.append(StringBuffer.java:365) at java.util.AbstractMap.toString(AbstractMap.java:562) at java.lang.String.valueOf(String.java:2013) at java.lang.StringBuffer.append(StringBuffer.java:365) at java.util.AbstractMap.toString(AbstractMap.java:562) ... (and so on and on)
Code:<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property> <property name="url"><value>jdbc:oracle:thin:@99.99.99.99:1521:BDDESBCN</value></property> <property name="username"><value>****</value></property> <property name="password"><value>****</value></property> </bean> (of course the ip is ficticious) <bean id="cartaAltaView" class="org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView"> <property name="url" value="/reports/cartaAlta.jasper"/> <property name="jdbcDataSource" ref="dataSource"/> <property name="headers"> <props> <prop key="Content-Disposition">attachment; filename=cartasBaja.pdf</prop> <prop key="Content-type">application/pdf</prop> </props> </property> </bean>
I don't know what i'm doing wrong. I know the report file is OK because if i don't render it by hand, it returns gracefully to the browser and opens in acrobat.
I'm using Spring 1.2.7, JasperReports 1.2.
<update>
I'm using Tomcat 3.3 (it's a requirement od the application). I've tried in Tomcat 4 and it works fine!! Now I'm even more puzzled...
Any hint? Thanks a lot!!!


Reply With Quote