I would like to put a report on a project I'm working on, and I decided to use the demoiselle component itself, demoiselle-report. But after implementing it and testing, it returns an exception. So I checked the problem is happening when performing dependency injection on the Report Class. I searched the user list, and I saw that many people had similar problems and that it was related to demoiselle version, I believe mine can be that too, since 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
Download demoiselle 2.5.0
demoiselle-report 2.2.0
First I inserted the dependency of the component in the pom of my project
<dependency>
<groupId>br.gov.frameworkdemoiselle.component</groupId>
<artifactId>demoiselle-report</artifactId>
<version>2.2.0</version>
</dependency>
Then I created a simple report, and I put .jasper
of it in the directory suggested in the documentation
@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 the 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="# {DocumentManutencaoListMB.listaDocTable}": javax.enterprise.inject.CreationException
09: 37: 52,706 ERROR [org.apache.catalina.core.ContainerBase. [jboss.web] [default-host] [/ DJCloud-security] [Faces Servlet]] (http-localhost-127.0 Servlet.service () for servlet Faces Servlet threw exception: java.lang.NoSuchMethodError: br.gov.frameworkdemoiselle.internal.producer.LoggerProducer.create (Ljava / lang / Class;) Lorg / slf4j / Logger;
Link to download full exception returned: link
I ran several tests and saw that leaving only the declaration of the report object together with the dependency injection, the error still persists, so I think it's an error when doing the dependency injection.
@Inject
private Report report;
If anyone has ever had the same problem, or can help, I'll be grateful.