Bom Dia pessoal,
Estou com problema para gerar o pdf pelo ireport.
Ele não encontra o arquivo jasper quando executado em ambiente de produção (Servidor), executando no ambiente de desenvolvimento (Netbenas 7.01) ele encontra normalmente.
O caminho que uso como path é /pacote/arquivo.jasper
print = JasperFillManager.fillReport(getClass().getResource(path).getPath(), param, ds);
Uso o tomcat 7.0.19 com JSF 2.1.2 + Primefaces 3.02M2 + Hibernate JPA2
Os arquivos jasper estão em um pacote dentro do .war
Alguma idéia ?
p/s já tentei usar assim e não funcionou:
FacesContext.getCurrentInstance().getExternalContext().getRealPath(path);
No aguardo de uma ajuda =)
Edit:
o erro é esse :
net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: C:\Arquivos%20de%20programas\Apache%20Software%20Foundation\Tomcat%207.0\webapps\Compras\WEB-INF\classes\report\Solicitacao.jasper
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:536)
at br.com.compras.util.Report.getPrint(Report.java:30)
at br.com.compras.bean.SolicitacaoBean.getImpressao(SolicitacaoBean.java:174)
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 javax.el.BeanELResolver.getValue(BeanELResolver.java:87)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)
at org.apache.el.parser.AstValue.getValue(AstValue.java:169)
at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)
at org.primefaces.component.filedownload.FileDownloadActionListener.processAction(FileDownloadActionListener.java:50)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:769)
at javax.faces.component.UICommand.broadcast(UICommand.java:300)
at javax.faces.component.UIData.broadcast(UIData.java:1093)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:794)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1259)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:851)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:257)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1764)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.FileNotFoundException: C:\Arquivos%20de%20programas\Apache%20Software%20Foundation\Tomcat%207.0\webapps\Compras\WEB-INF\classes\report\Solicitacao.jasper
... 41 more
Sendo que está apontando para o arquivo certo, já confirmei se ele está la