me salta el error siguiente cuando quiero ver algun reporte :
Cita:
mi archivo ReportesJaspers .. contiene lo siguiente :java.lang.IllegalStateException: getWriter() ya ha sido llamado para esta respuesta
org.apache.catalina.connector.Response.getOutputSt ream(Response.java:579)
org.apache.catalina.connector.ResponseFacade.getOu tputStream(ResponseFacade.java:183)
javax.servlet.ServletResponseWrapper.getOutputStre am(ServletResponseWrapper.java:102)
com.reports.ReportesJaspers.processRequest(Reporte sJaspers.java:123)
com.reports.ReportesJaspers.doPost(ReportesJaspers .java:166)
javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:390)
org.apache.catalina.connector.Response.getOutputSt ream(Response.java:579)
org.apache.catalina.connector.ResponseFacade.getOu tputStream(ResponseFacade.java:183)
javax.servlet.ServletResponseWrapper.getOutputStre am(ServletResponseWrapper.java:102)
com.reports.ReportesJaspers.processRequest(Reporte sJaspers.java:123)
com.reports.ReportesJaspers.doPost(ReportesJaspers .java:166)
javax.servlet.http.HttpServlet.service(HttpServlet .java:637)
javax.servlet.http.HttpServlet.service(HttpServlet .java:717)
org.netbeans.modules.web.monitor.server.MonitorFil ter.doFilter(MonitorFilter.java:390)
Cita:
si alguien me indicara que puede estar pasando.... protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter pwriter = response.getWriter();
pwriter.println("<script type='text/javascript'>");
pwriter.println("window.print();window.close();");
pwriter.println("</script>");
try {
Connection conn = null;
conn = DBase.getInstance().getConnection ();
int sw = Integer.parseInt(request.getParameter("doc_cod"));
String Reporte = "";
switch (sw) {
case 1:
Reporte = "/com/reports/Boleta.jasper";
break;
case 3:
Reporte = "/com/reports/Factura.jasper";
break;
case 4:
Reporte = "/com/reports/GuiaRemision.jasper";
break;
case 5:
Reporte = "/com/reports/Interno.jasper";
break;
case 6:
Reporte = "/com/reports/GuiaRemision2.jasper";
break;
}
InputStream reportStream = this.getClass().getResourceAsStream(Reporte);
HashMap hm = new HashMap();
hm.put("OPE_COD", Integer.parseInt(request.getParameter("ope_cod"))) ;
JasperPrint jasperPrint = JasperFillManager.fillReport(reportStream, hm, conn);
generateHtmlOutput(jasperPrint, request,pwriter);
} catch (JRException e) {
// display stack trace in the browser
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
e.printStackTrace(printWriter);
response.setContentType("text/plain");
response.getOutputStream().print(stringWriter.toSt ring());
}
}
throws ServletException, IOException, SQLException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter pwriter = response.getWriter();
pwriter.println("<script type='text/javascript'>");
pwriter.println("window.print();window.close();");
pwriter.println("</script>");
try {
Connection conn = null;
conn = DBase.getInstance().getConnection ();
int sw = Integer.parseInt(request.getParameter("doc_cod"));
String Reporte = "";
switch (sw) {
case 1:
Reporte = "/com/reports/Boleta.jasper";
break;
case 3:
Reporte = "/com/reports/Factura.jasper";
break;
case 4:
Reporte = "/com/reports/GuiaRemision.jasper";
break;
case 5:
Reporte = "/com/reports/Interno.jasper";
break;
case 6:
Reporte = "/com/reports/GuiaRemision2.jasper";
break;
}
InputStream reportStream = this.getClass().getResourceAsStream(Reporte);
HashMap hm = new HashMap();
hm.put("OPE_COD", Integer.parseInt(request.getParameter("ope_cod"))) ;
JasperPrint jasperPrint = JasperFillManager.fillReport(reportStream, hm, conn);
generateHtmlOutput(jasperPrint, request,pwriter);
} catch (JRException e) {
// display stack trace in the browser
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
e.printStackTrace(printWriter);
response.setContentType("text/plain");
response.getOutputStream().print(stringWriter.toSt ring());
}
}
nota: todos los reportes funcionaban correctamente hasta que se cambio el modo de conexion a la base de datos... ahora se conecta por un pool de conexiones.
Saludos