Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RichFaces + JasperReport error - help  RSS feed

 
Jose Araya
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

I'm trying to show a report in a Java web application.

I'm using:
J2EE 6
RichFaces 4.0
GlassFish 3
JasperReports 4.1.3

I'm getting the data from an oracle DB

The application executes the stored procedure and it gets the data, that part is ok, but I'm having some troubles when I try to show my report, it doesn't work. I'm getting the next message:

An Error Occurred:
java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.extensions.ExtensionsEnvironment

The stack trace
javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.extensions.ExtensionsEnvironment
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:315)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:775)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1267)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
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:312)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1523)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.extensions.ExtensionsEnvironment
at net.sf.jasperreports.repo.RepositoryUtil.getRepositoryServices(RepositoryUtil.java:57)
at net.sf.jasperreports.repo.RepositoryUtil.revertRepositoryContext(RepositoryUtil.java:109)
at net.sf.jasperreports.engine.JRAbstractExporter.resetExportContext(JRAbstractExporter.java:797)
at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:407)
at net.sf.jasperreports.engine.JasperExportManager.exportReportToPdf(JasperExportManager.java:184)
at batcca.enablers.reportes.GeneradorReportes.generarReportePdf(GeneradorReportes.java:91)
at batcca.enablers.web.beans.BReporte.generarReporte(BReporte.java:61)
at batcca.enablers.web.beans.BReporte.visualizarReporte(BReporte.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(AstValue.java:234)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:297)
at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:98)
at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 32 more

My code is written in this way:

/**
* Construye un reporte en formato PDF y retorna su contenido en un arreglo
* de bytes.
* @param fechaInicio
* @param fechaFinal
* @param codigoUsuario
* @param codigoPdv
* @param codigoPais
* @param codigoArea
* @param codigoTerritorio
* @param codigoRuta
* @param codigoTipo
* @param codigoSubtipo
* @param codigoCanal
* @return
*/
public byte[] generarReportePdf(
Date fechaInicio,
Date fechaFinal,
int codigoUsuario,
String codigoPdv,
String codigoPais,
String codigoArea,
String codigoTerritorio,
String codigoRuta,
String codigoTipo,
String codigoSubtipo,
String codigoCanal) {
byte[] archivo = null;

JasperPrint jasperPrint = null;

try {
ArrayList<RegistroReporteMerchandising> resultado =
this.getReporteDA().getRegistrosReporteMerchandising(
fechaInicio,
fechaFinal,
codigoUsuario,
codigoPdv,
codigoPais,
codigoArea,
codigoTerritorio,
codigoRuta,
codigoTipo,
codigoSubtipo,
codigoCanal);
if (this.getReporteDA().getEsValida()) {

HashMap map = new HashMap();

String reporte = Configuracion.getValor(Constantes.V_RUTA_REPORTE_MERCH);
JRBeanCollectionDataSource jrbc = new JRBeanCollectionDataSource(resultado);
jasperPrint = JasperFillManager.fillReport(reporte, map, jrbc);
archivo = JasperExportManager.exportReportToPdf(jasperPrint);
}
} catch (Exception ex) {
ex.printStackTrace();
this.registrarError(Constantes.ERROR_REPORTE_MERCH, ex.getMessage());
} finally {
return archivo;
}
}

That is my trouble, and I need some help.

Thanks.

Regards,

Jose Araya.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!