Jasper report is not generated on production server

Asked

Viewed 846 times

1

a problem in the use of JasperReports.

I created a class to generate the reports, from some parameters. It inside the Eclipse generates normally, but when I export the WAR and put into production, it does nothing.

At first, I noticed that there was a detail - he couldn’t find the file by using %20 instead of the spaces in the report path, so I noticed in the Tomcat log, which had given a FileNotFoundException. Hence I used the URLDecoder.decode to resolve this, and he no longer returns the FileNotFoundException, but still not generating the report out of Eclipse.

Someone went through something like this?

public void imprimir(String arquivo, String nmTitulo,String nmParams, String nmParamsSegunda, List<?> dados) throws Exception{      
JasperReport report = null;
try{
    String caminhoRelatorio = this.getPathToReportPackage() + arquivo+".jrxml";
    System.out.println("porCentoVinte:"+caminhoRelatorio);          
    caminhoRelatorio=URLDecoder.decode(caminhoRelatorio,"UTF-8");           
    System.out.println("porCentoVinte:"+caminhoRelatorio);
    report = JasperCompileManager.compileReport(caminhoRelatorio);          

    HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
    VsecUsuario usr = (VsecUsuario) session.getAttribute("usuarioLogado");               
    String nmUsuario = usr.getNmUsuario();
    String nmEmpresa = new Fncts().nmEmpresa();

    Map relParams = new HashMap();
    relParams.put("pNmTitulo",          nmTitulo);
    relParams.put("pNmEmpresa",         nmEmpresa);
    relParams.put("pNmRelParam",        nmParams);
    relParams.put("pNmRelParamSegunda", nmParamsSegunda);
    relParams.put("pUsuarioSistema",    nmUsuario);

    JasperPrint pronto = JasperFillManager.fillReport(report, relParams, new JRBeanCollectionDataSource(dados));
    JasperViewer viewer = new JasperViewer( pronto , false );                
    viewer.setVisible(true);   
}catch(Exception e){
    new Fncts().aviso(e.getMessage());
}     

}

Aqui são os arquivos que estão na lib do TomCat

And here the log

porCentoVinte:/D:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/SGC/WEB-INF/classes/br/com/virtus/jasper/reembolso.jrxml
porCentoVinte:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/classes/br/com/virtus/jasper/reembolso.jrxml
porCentoVinte:D:\Program%20Files\Apache%20Software%20Foundation\Tomcat%206.0\webapps\SGC\WEB-INF\classes\br\com\virtus\jasper\extratocartao.jrxml
porCentoVinte:D:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\SGC\WEB-INF\classes\br\com\virtus\jasper\extratocartao.jrxml
[EL Finest]: jpa: 2015-05-14 16:21:12.003--ServerSession(14536956)--Thread(Thread[Finalizer,8,system])--Begin undeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 6
[EL Finest]: jpa: 2015-05-14 16:21:12.003--ServerSession(14536956)--Thread(Thread[Finalizer,8,system])--End undeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 5
[EL Finest]: jpa: 2015-05-14 16:21:12.003--ServerSession(14536956)--Thread(Thread[Finalizer,8,system])--Begin undeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 5
[EL Finest]: jpa: 2015-05-14 16:21:12.003--ServerSession(14536956)--Thread(Thread[Finalizer,8,system])--End undeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 4
[EL Finest]: jpa: 2015-05-14 16:21:12.003--ServerSession(14536956)--Thread(Thread[Finalizer,8,system])--Begin undeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 4
[EL Finest]: jpa: 2015-05-14 16:21:12.003--ServerSession(14536956)--Thread(Thread[Finalizer,8,system])--End undeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 3
[EL Finest]: jpa: 2015-05-14 16:21:13.581--ServerSession(14536956)--Thread(Thread[http-8081-7,5,main])--Begin predeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 3
[EL Finest]: jpa: 2015-05-14 16:21:13.581--ServerSession(14536956)--Thread(Thread[http-8081-7,5,main])--End predeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 4
[EL Finest]: jpa: 2015-05-14 16:21:13.581--ServerSession(14536956)--Thread(Thread[http-8081-7,5,main])--Begin deploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 4
[EL Finest]: jpa: 2015-05-14 16:21:13.581--ServerSession(14536956)--Thread(Thread[http-8081-7,5,main])--End deploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 4
----TESTE DE BUSCA POR CÓDIGO----
[EL Finer]: connection: 2015-05-14 16:21:13.581--ServerSession(14536956)--Thread(Thread[http-8081-7,5,main])--client acquired: 8519566
[EL Finer]: transaction: 2015-05-14 16:21:13.581--ClientSession(8519566)--Thread(Thread[http-8081-7,5,main])--acquire unit of work: 11594463
[EL Finest]: query: 2015-05-14 16:21:13.581--UnitOfWork(11594463)--Thread(Thread[http-8081-7,5,main])--Execute query ReadObjectQuery(name="readFiliai" referenceClass=Filiai sql="SELECT CD_FILIAL, CD_ARQ_ENVIO, CD_ARQ_RETORNO, CD_CEP_ENDERECO_FILIAL, CD_CNPJ, CD_DDD_FILIAL, CD_FAX_FILIAL, CD_IE_FILIAL, CD_IM_FILIAL, CD_LOCAL_COBRANCA, CD_NUMERO_ENDERECO_FILIAL, CD_OCORR_DEPOSITO_CHEQUE, CD_SERIE_NOTA_FISCAL, CD_TELEFONE_FILIAL, CD_ULTIMA_NF_FILIAL, CD_ULTIMO_PEDIDO_COMPRA, DONE, DTL, NM_BAIRRO_ENDERECO_FILIAL, NM_CIDADE_FILIAL, NM_COMPL_ENDERECO_FILIAL, NM_ENDERECO_FILIAL, NM_FILIAL, PC_ISS, PC_MAXIMO_FRETE_FILIAL, PC_MULTA_FILIAL, QT_DIAS_CARENCIA_FILIAL, SG_UF FROM FILIAIS WHERE (CD_FILIAL = ?)")
[EL Finest]: transaction: 2015-05-14 16:21:13.581--UnitOfWork(11594463)--Thread(Thread[http-8081-7,5,main])--Register the existing object br.com.virtus.sgc.model.Filiai@87208fa3
[EL Finest]: jpa: 2015-05-14 16:21:14.19--ServerSession(14536956)--Thread(Thread[Finalizer,8,system])--Begin undeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 4
[EL Finest]: jpa: 2015-05-14 16:21:14.19--ServerSession(14536956)--Thread(Thread[Finalizer,8,system])--End undeploying Persistence Unit SGCProjectJPA; session file:/D:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/SGC/WEB-INF/lib/SGCProjectJPA.jar_SGCProjectJPA; state Deployed; factoryCount 3
  • no stacktrace of error?

  • In the log there is no message... I am not on the machine at the moment, but as soon as I show. There is no error in the log, and it normally runs when debugging in eclipse. And this intrigues me.

  • 1

    Checked the server classpath?

  • @Alexandrestrevenski Classpath would be the Tomcat lib folder? If it is, I checked, I will add some information.

  • I had the same problem, I was able to fix it, it was Jasper’s source. If it’s not that try to give a Tail(if it’s linux) in the log and try to run again to see the right log and real time in production

  • 1

    Instead of using the path to the report, input stream of him, recovered from classpath, something like InputStream is = SuaClasse.class.getResourceAsStream("/br/com/virtus/jasper/reembolso.jrxml"); JasperReport report = JasperCompileManager.compileReport(is);

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.