Artur Cardoso
unread,Sep 13, 2010, 12:21:25 PM9/13/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to javasf: JavaServer Faces Group
Boa tarde
Pessoal
Tenho um aplicação JSF(Mojarra )+ RichFaces que estar estar
funcionando ok.
Agora vem o problema baixe as apostilas do Jasper e também
iReport-3.7.2, fiz o relatório com simples query no iReport estar OK
e compilado, porém quando tendo implementa o código na aplicação não
funcionar.
O erro ocorre nesta
linha:JasperFillManager.fillReportToFile( pathRel, params, conn );
Algum dica ?
Alguém pode confirma as JAR Jasper ?
public Object gerarRelatorioAlunoCadastros() throws IOException,
EscolaDAOException
{
byte[] bytes = null;
try {
this.conn = ConnectionEscolaFactory.getConnection( );
Map params = new HashMap();
params.put( JRParameter.REPORT_CLASS_LOADER,
getClass().getClassLoader() );
FacesContext facesContext = FacesContext.getCurrentInstance();
ServletContext servletContext = (ServletContext)
facesContext.getExternalContext().getContext();
String pathRel = servletContext.getRealPath("/relatorios/
listadealunos.jasper");
JasperFillManager.fillReportToFile( pathRel, params, conn );
JasperExportManager.exportReportToPdfFile( "/relatorios/
listadealunos.jrprint" );
JasperViewer.viewReport( "relatorios/listadealunos.pdf", false );
} catch (JRException e) {
e.printStackTrace();
}
if (bytes != null && bytes.length > 0) {
HttpServletResponse response = (HttpServletResponse)
FacesContext.getCurrentInstance().getExternalContext().getResponse();
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(bytes);
}
return null;
}
ERRO :
13/09/2010 13:03:34 com.sun.faces.application.ActionListenerImpl
processAction
SEVERE: java.lang.NullPointerException
javax.faces.el.EvaluationException: java.lang.NullPointerException
at
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:
102)
at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:
102)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)