Holas he tratado de generar un reporte en Ireport y no me funca :S:S :(
mi ultimo intento fue:
Connection cnxn = null;
try{
JasperReport jasperReport;
JasperPrint jasperPrint;
JasperDesign jasperDesign;
Conect conec = new Conect();
cnxn = conec.conectar();
//out.println(" <H1>0!!</H1>\n");
// load JasperDesign from XML and compile it into JasperReport
// fill JasperPrint using fillReport() method
out.println("********Compilamos pago_nomina.jrxml OK********");
System.setProperty(
"jasper.reports.compile.class.path",
application.getRealPath("/WEB-INF/lib/jasperreports-3.0.1.jar") +
System.getProperty("path.separator") +
application.getRealPath("/WEB-INF/classes/")
);
out.println("*****Cargamos el jasperreports-0.6.0.jar OK*********");
System.setProperty(
"jasper.reports.compile.temp",
application.getRealPath("/GUI/")
);
JasperCompileManager.compileReportToFile(applicati on.getRealPath("/GUI/1.jrxml"));
out.println("******Fin de la Compilamos el archivos***********");
/////////////////////////////////////////////
File reportFile = new File(application.getRealPath("/GUI/1.jasper"));
Map parameters = new HashMap();
parameters.put("id", "13415640-6");
byte[] bytes =
JasperRunManager.runReportToPdf(
reportFile.getPath(),
parameters,
cnxn
);
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(bytes, 0, bytes.length);
ouputStream.flush();
ouputStream.close();
out.println("jasperPDF OK..............");
///////////////////////////////////////////////////////////////
out.println("Fin del reporte pago_reporte_nomina.............");
}catch (JRException e){
out.println("Error:" +e.getMessage());
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
e.printStackTrace(printWriter);
response.setContentType("text/plain");
response.getOutputStream().print(stringWriter.toSt ring());
}
catch (Exception e)
{
e.printStackTrace();
out.println("Error2:" +e.getMessage());
}
%>
El codigo está tal cual según la pagina :http://www.adictosaltrabajo.com/tutoriales/tutoriales.php?pagina=ireport
y me tira este error de compilación y no se que es, ojala u me ayuden
Gracias
net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
1. Syntax error on token "49", delete this token
public class 49_1219337594109_549123 extends JREvaluator
<>
1 errors
at net.sf.jasperreports.engine.design.JRAbstractCompi ler.compileReport(JRAbstractCompiler.java:193)
at net.sf.jasperreports.engine.JasperCompileManager.c ompileReport(JasperCompileManager.java:220)
at net.sf.jasperreports.engine.JasperCompileManager.c ompileReportToFile(JasperCompileManager.java:136)
at net.sf.jasperreports.engine.JasperCompileManager.c ompileReportToFile(JasperCompileManager.java:95)
at org.apache.jsp.GUI.imprime_jsp._jspService(imprime _jsp.java:158)
at org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
at org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:337)
at org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet .java:803)
at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.servic e(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run( JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
P.D. ta larguito el post :P :)