1
I would like to put a report on a project I’m working on, and I decided to use the component that Moiselle itself provides, the Demoiselle-report. But after implementing it and testing, it returns an Exception. From what I’ve seen, the problem is happening by injecting dependency into the Report Class. I searched the list of users, and saw that many people had similar problems and that the same was related to the version of Demoiselle, I believe that mine can be this too, because I’m using the latest version of the framework. Below I will describe the implementations I made in my project to use the component.
Versions
Demoiselle 2.5.0
Demoiselle-report 2.2.0
First I inserted the component dependency into my project’s pom
<dependency>
<groupId>br.gov.frameworkdemoiselle.component</groupId>
<artifactId>demoiselle-report</artifactId>
<version>2.2.0</version>
</dependency>
Then I came up with a simple report, and I put the .jasper
of the same in the suggested directory in the documentation
Having done that, I went to Managed bean to create the report object and the method that will be called by JSF (I removed the Exception "Jrexception", as the eclipse stated that it was not necessary to do so)
@NextView("/private/documento_manutencao_list.jsf")
@ViewController
public class DocumentoManutencaoListMB extends GenericListPageBean<Documento, String, DocumentoBC> {
private static final long serialVersionUID = 1L;
@Inject
private DocumentoBC documentoBC;
@Inject
private Report report;
@Inject
private FileRenderer renderer;
public String showReport() {
Map<String, Object> param = new HashMap<String, Object>();
try {
byte[] buffer = this.report.export(documentoBC.findAll(), param, Type.PDF);
this.renderer.render(buffer, FileRenderer.ContentType.PDF, "relatorio.pdf");
} catch (Exception e) {
Faces.addMessage(e);
}
return getNextView();
}
// JRException não foi usado pois o eclipse retorna que é um código inacessível.
// Unreachable catch block for JRException. This exception is never thrown from the try statement body
And in JSF I put a call on the button, as described in the documentation
<p:commandButton process="listaDocsEmissaoPropria" icon="ui-icon-print" value="Imprimir" action="#{documentoManutencaoListMB.showReport}" />
After performing all these procedures, I run the application and when it accesses the Managed bean page it returns to Exception below:
09:37:52,643 GRAVE [javax.enterprise.resource.webcontainer.jsf.application] (http-localhost-127.0.0.1-8080-1) Error Rendering View[/private/index.xhtml]: javax.el.ELException: /private/documento_manutencao_list.xhtml @59,68 value="#{documentoManutencaoListMB.listaDocTable}": javax.enterprise.inject.Creationexception
09:37:52,706 ERROR [org.apache.Containerbase.core.Containerbase. [jboss.web]. [default-host]. [/Djcloud-security]. [Faces Servlet]] (http-localhost-127.0.0.1-8080-1) Servlet.service() for Servlet Faces Servlet threw Exception: java.lang.Nosuchmethoderogate: br.gov.frameworkdemoiselle.internal.Producer.LoggerProducer.create(Ljava/lang/Class;)Lorg/slf4j/Logger;
Full Exception download link returned: https://www.dropbox.com/s/xxuuza4j7scb2wc/exception_retornada.txt?dl=0
I performed several tests and saw that leaving only the report object declaration together with the dependency injection, the error still persists, so I believe it is an error at the time of performing the dependency injection.
@Inject
private Report report;
If anyone has ever been through the same trouble, or can help, I’d be grateful.