Erro relatorio

5 respostas
F

Estou testando o Jasper com eclipse, quando mando imprimir me aparece esse erro:

Exception in thread AWT-EventQueue-0 java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.design.JRJavacCompiler

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at net.sf.jasperreports.engine.JasperCompileManager.getCompiler(JasperCompileManager.java:823)

at net.sf.jasperreports.engine.JasperCompileManager.getEvaluator(JasperCompileManager.java:380)

at net.sf.jasperreports.engine.fill.JRFillDataset.createCalculator(JRFillDataset.java:484)

at net.sf.jasperreports.engine.fill.BaseReportFiller.(BaseReportFiller.java:154)

at net.sf.jasperreports.engine.fill.JRBaseFiller.(JRBaseFiller.java:268)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:69)

at net.sf.jasperreports.engine.fill.JRVerticalFiller.(JRVerticalFiller.java:57)

at net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(JRFiller.java:219)

at net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(JRFiller.java:234)

at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:178)

at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:310)

at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:771)

at view.Relatorios.geraRelatorio(Relatorios.java:316)

at view.Relatorios$1.mouseClicked(Relatorios.java:59)

at java.awt.Component.processMouseEvent(Unknown Source)

at javax.swing.JComponent.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Window.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEventImpl(Unknown Source)

at java.awt.EventQueue.access$500(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.awt.EventQueue$3.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue$4.run(Unknown Source)

at java.awt.EventQueue$4.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

5 Respostas

S

Pode mostrar os códigos relativos a essas linhas?

F

No caso é um botão que chama a função

public void geraRelatorio() {

HashMap param = new HashMap();

try {

JasperPrint jp = JasperFillManager.fillReport(src/reports/Blank_A4.jasper, param);

JasperViewer jw = new JasperViewer(jp);

jw.setVisible(true);

} catch (JRException e) {
e.printStackTrace();
	}
}
darlan_machado

Tem certeza que colocou todos os jars do jasper no classpath?

F

Sim

image

betofroesjr

https://mvnrepository.com/artifact/net.sf.jasperreports/jasperreports/6.5.1

Dá uma olhada neste link mostra todas as dependencias pode ser que vc está utilizando algum recurso destas libs e por isso não inicializa … eu acho se puder utilize maven facilita bastante

Criado 13 de março de 2018
Ultima resposta 14 de mar. de 2018
Respostas 5
Participantes 4