Jasper +SF(Mojarra )+ RichFaces : ERRO

13 views
Skip to first unread message

Artur Cardoso

unread,
Sep 13, 2010, 12:21:25 PM9/13/10
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)

josane...@gmail.com

unread,
Sep 17, 2010, 9:05:46 AM9/17/10
to javasf: JavaServer Faces Group
Tenta adicionar o parâmetro no formulário "Pai".
Reply all
Reply to author
Forward
0 new messages