Solucionado (ver solução)
Solucionado
(ver solução)
2
respostas

Problema com IReport

Olá estou com o seguinte problema com ireport.

Minha classe para gerar o arquivo é:

public class RelatorioPacienteService {

    public void gerarRelatorio(List<Paciente> pacientes){

        try {
            JasperReport report = JasperCompileManager.compileReport("relatorios/relatorioPaciente.jrxml");
            JasperPrint print = JasperFillManager.fillReport(report, null,new JRBeanCollectionDataSource(pacientes));
            JasperExportManager.exportReportToPdfFile(print,"relatorios/RelatorioClientes.pdf");
        } catch (JRException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }

    }

}

O erro que aparece no console é:

15:08:10,435 ERROR [stderr] (default task-21) net.sf.jasperreports.engine.JRException: Error compiling report java source files : C:\POO\Web\WildFly\wildfly-10.0.0.Final\bin\relatorioPaciente_1476036490420_161026.java 

15:08:10,435 ERROR [stderr] (default task-21)     at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:106)

15:08:10,435 ERROR [stderr] (default task-21)     at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:77)

15:08:10,435 ERROR [stderr] (default task-21)     at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)

15:08:10,436 ERROR [stderr] (default task-21)     at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)

15:08:10,436 ERROR [stderr] (default task-21)     at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:173)

15:08:10,436 ERROR [stderr] (default task-21)     at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:448)

15:08:10,436 ERROR [stderr] (default task-21)     at scf.model.service.RelatorioPacienteService.gerarRelatorio(RelatorioPacienteService.java:24)

15:08:10,436 ERROR [stderr] (default task-21)     at scf.model.facade.rs.RelatorioPacienteFacade.gerarRelatorio(RelatorioPacienteFacade.java:33)

15:08:10,436 ERROR [stderr] (default task-21)     at scf.model.facade.rs.RelatorioPacienteFacade$Proxy$_$$_WeldClientProxy.gerarRelatorio(Unknown Source)

15:08:10,437 ERROR [stderr] (default task-21)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

15:08:10,437 ERROR [stderr] (default task-21)     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

15:08:10,437 ERROR [stderr] (default task-21)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

15:08:10,437 ERROR [stderr] (default task-21)     at java.lang.reflect.Method.invoke(Unknown Source)

15:08:10,437 ERROR [stderr] (default task-21)     at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:139)

15:08:10,438 ERROR [stderr] (default task-21)     at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295)

15:08:10,438 ERROR [stderr] (default task-21)     at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249)

15:08:10,438 ERROR [stderr] (default task-21)     at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236)

15:08:10,438 ERROR [stderr] (default task-21)     at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)

15:08:10,439 ERROR [stderr] (default task-21)     at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)

15:08:10,439 ERROR [stderr] (default task-21)     at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)

15:08:10,439 ERROR [stderr] (default task-21)     at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)

15:08:10,439 ERROR [stderr] (default task-21)     at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)

15:08:10,440 ERROR [stderr] (default task-21)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

15:08:10,440 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)

15:08:10,440 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

15:08:10,440 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

15:08:10,441 ERROR [stderr] (default task-21)     at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

15:08:10,441 ERROR [stderr] (default task-21)     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

15:08:10,441 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

15:08:10,441 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

15:08:10,442 ERROR [stderr] (default task-21)     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

15:08:10,442 ERROR [stderr] (default task-21)     at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

15:08:10,443 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

15:08:10,446 ERROR [stderr] (default task-21)     at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)

15:08:10,447 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)

15:08:10,447 ERROR [stderr] (default task-21)     at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

15:08:10,447 ERROR [stderr] (default task-21)     at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)

15:08:10,448 ERROR [stderr] (default task-21)     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

15:08:10,448 ERROR [stderr] (default task-21)     at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

15:08:10,448 ERROR [stderr] (default task-21)     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

15:08:10,449 ERROR [stderr] (default task-21)     at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

15:08:10,449 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)

15:08:10,449 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)

15:08:10,450 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)

15:08:10,450 ERROR [stderr] (default task-21)     at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)

15:08:10,450 ERROR [stderr] (default task-21)     at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)

15:08:10,450 ERROR [stderr] (default task-21)     at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)

15:08:10,450 ERROR [stderr] (default task-21)     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

15:08:10,450 ERROR [stderr] (default task-21)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

15:08:10,450 ERROR [stderr] (default task-21)     at java.lang.Thread.run(Unknown Source)

15:08:10,451 ERROR [stderr] (default task-21) Caused by: java.io.IOException: Cannot run program "javac": CreateProcess error=2, O sistema não pode encontrar o arquivo especificado

15:08:10,451 ERROR [stderr] (default task-21)     at java.lang.ProcessBuilder.start(Unknown Source)

15:08:10,452 ERROR [stderr] (default task-21)     at java.lang.Runtime.exec(Unknown Source)

15:08:10,452 ERROR [stderr] (default task-21)     at java.lang.Runtime.exec(Unknown Source)

15:08:10,452 ERROR [stderr] (default task-21)     at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:75)

15:08:10,453 ERROR [stderr] (default task-21)     ... 49 more

15:08:10,453 ERROR [stderr] (default task-21) Caused by: java.io.IOException: CreateProcess error=2, O sistema não pode encontrar o arquivo especificado

15:08:10,454 ERROR [stderr] (default task-21)     at java.lang.ProcessImpl.create(Native Method)

15:08:10,455 ERROR [stderr] (default task-21)     at java.lang.ProcessImpl.<init>(Unknown Source)

15:08:10,455 ERROR [stderr] (default task-21)     at java.lang.ProcessImpl.start(Unknown Source)

15:08:10,455 ERROR [stderr] (default task-21)     ... 53 more

Alguém saberia me informar o porque?

Obs.: O relatório está na linguagem java, alterei no arquivo quando estava no ireport.

2 respostas

Oi Maicon,

repare a exceção:

15:08:10,451 ERROR [stderr] (default task-21) Caused by: java.io.IOException: Cannot run program "javac": CreateProcess error=2, O sistema não pode encontrar o arquivo especificado

Quando vc chama a aquele método o Jasper tentar compilar mas não encontra o javac.

Vc está com o JDK instalado? Tbm garante que a variável de ambiente JAVA_HOME aponta para a pasta bin do JDK.

abs

solução!

Olá Nico.

Sim o JDK está instalado e a variável de ambiente está normal.

Obrigado por responder minha pergunta.

No dia 11/10/2016 consegui ver que o arquivo estava sendo apontado para o lugar errado, apontei novamente o arquivo e agora o PDF está sendo gerado.

Novamente muito obrigado por responder minha pergunta.