1

We have a Java EE aplicattion, JRE 6, MySQL 5.5, running on Tomcat 5.5. We have several JR reports working right but there is one of them that causes the following Tomcat error:

org.apache.jasper.JasperException: getOutputStream() ya ha sido llamado para esta respuesta
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:460)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:367)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1085)
    org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:263)
    org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:398)
    org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:318)
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:241)
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    com.tsystems.web.common.FiltroSeguridad.doFilter(FiltroSeguridad.java:79)

Eclipse's console:

Could not load object from location : ..\..\iReport\PDFInformeCuadroGestionSub1.jasper
net.sf.jasperreports.engine.JRException: Could not load object from location : ..\..\iReport\PDFInformeCuadroGestionSub1.jasper
    at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:271)
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:311)
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:260)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:275)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:426)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1380)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:692)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:113)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:888)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:810)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:89)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:601)
    at com.tsystems.web.ModuloInformes.InformesNuevos.InformeGestion.Actions.InformeGestionAction.generarReporte(InformeGestionAction.java:1573)
    at com.tsystems.web.ModuloInformes.InformesNuevos.InformeGestion.Actions.InformeGestionAction.generarInformeGestion(InformeGestionAction.java:207)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:270)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:187)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at com.tsystems.web.common.FiltroSeguridad.doFilter(FiltroSeguridad.java:79)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:875)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    at java.lang.Thread.run(Unknown Source)

The method to generate the report is this (uncomplete, only the call and few more things):

private void generarReporte(List info, 
                            InformeGestionFormBean gestionBean, 
                            HttpServletRequest request, 
                            HttpServletResponse response,
                            String descripDispo) {
    try {
        ServletOutputStream out = response.getOutputStream();

        String centro = descripDispo;

        String imagenlogo = ".." + File.separator + ".." + File.separator + "images" + File.separator + "logo2.jpg";
        String imageninforme = ".." + File.separator + ".." + File.separator + "images" + File.separator + "finforme.jpg";
        String imagenflecha = ".." + File.separator + ".." + File.separator + "images" + File.separator + "flecha.jpg";

        String ruta = ".." + File.separator + ".." + File.separator + "iReport" + File.separator;

        Map parametros = new HashMap();
        parametros.put("TITULO", "INFORME CUADRO DE GESTION DE "+centro+"");
        parametros.put("FECHA_ANYO", gestionBean.getAnioPeriodo());
        parametros.put("CENTRO", centro);
        parametros.put("IMAGEN_LOGO", imagenlogo);
        parametros.put("IMAGEN_INFORME", imageninforme);
        parametros.put("IMAGEN_FLECHA", imagenflecha);
        parametros.put("SUBREPORT_DIR", ruta);

        InputStream is = null;

        String header = "";

        is = InformeGestionAction.class.getClassLoader().getResourceAsStream(ruta + "InformeCuadroGestion.jrxml");

        header = "attachment; filename=\"InformeCuadroGestion";

        JRExporter exporter = null;
        JasperReport reporte = JasperCompileManager.compileReport(is);

        JRDataSource aux = new JRBeanCollectionDataSource(info);

        JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, parametros, aux);

This report worked fine few weeks ago, but now it doesn't. I've tried using code from the backup from the time when it worked ok, but the problem is still there. Maybe I changed configuration or something, I don't know.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
unai
  • 11
  • 1
  • 3
  • 2
    Log `ruta` variable out and the following expression `new File(ruta).exists()` to see if it is present – Wojciech Owczarczyk Sep 05 '12 at 07:50
  • @unai You can read [My Jasper Report can no longer find a subreport in the same directory after server move](http://stackoverflow.com/q/11848788/876298) post – Alex K Sep 05 '12 at 09:13
  • Thanks Wojtek and Alex K. I'm trying an abosulte path like "C:\Documents and Settings\Administrador\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\phnemos_ph\iReport\" but I obtain a new error : "net.sf.jasperreports.engine.JRException: java.net.MalformedURLException". – unai Sep 06 '12 at 09:58
  • I've tried to check the absolute path with new File(ruta).exists() (I don't know if I have to do something first to gest 'ruta' logged out...) and ruta seems to exist. The thing is that other jaspereports worck ok, but they are simple reports. This report uses subreports and that's the problem. It worked fine before, but now... – unai Sep 06 '12 at 10:01

0 Answers0