Jasper

1 resposta
pacheco

Pessoal;

fiz um teste para um relatório que criei no iReport no qual o relatório está ok !

agora só falta na minha aplicação rodar o jasper e exibir o relatório

só que dá o erro abaixo:

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

at dori.jasper.engine.fill.JRBaseFiller.<clinit>(JRBaseFiller.java:121)

at dori.jasper.engine.fill.JRFiller.fillReport(JRFiller.java:110)

at dori.jasper.engine.JasperFillManager.fillReport(JasperFillManager.java:219)

at dori.jasper.engine.JasperManager.fillReport(JasperManager.java:738)

at teste.impcria(teste.java:76)

at teste.access$0(teste.java:62)

at teste$1.actionPerformed(teste.java:54)

at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)

at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)

at javax.swing.DefaultButtonModel.setPressed(Unknown Source)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)

at java.awt.Component.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.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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)

alguma classe está faltando, estou certo? mas qual ?

meu codigo:

private void impcria(){

File relatarq = new File(C:\Arquivos de programas\eclipse\workspace\teste-jasper + nomeArquivo);

if (relatarq.exists())

System.out.println (Arquivo existe);

JasperReport jasperReport = null;

JasperPrint jasperPrint = null;

JRViewer jrv = null;

Map parameters = new HashMap();
try{
    jasperReport = JasperManager.loadReport(localArq);
    jasperPrint = JasperManager.fillReport(jasperReport,parameters,getConexao());   //ERRO AQUI !!! 
    jrv = new JRViewer(jasperPrint);
} catch (JRException e){ e.printStackTrace();}

   JFrame frame = new JFrame("Relatório");
    JPanel painel = new JPanel();
painel.add(jrv);
frame.getContentPane().add(painel);
frame.setSize( 800,500);
frame.pack();
frame.show();
}

e o engraçado que o jasperreports-0.5.1.jar está no meu classpath … alguém poderia me ajudar ???

Grato

1 Resposta

brlima

Importa as packages abaixo

import dori.jasper.engine.*; import dori.jasper.view.JRViewer; import dori.jasper.view.*;

E nao adianta colocar so o jasper.jar, vc deve colocar todas as cicliotecas que ele usa, inclusive as bibliotecas:
[list]
commons-logging.jar
[/list]

que é a biblioteca que falta e seu compilador nao tá achando.
Para vc conseguir compilar certinho, vc tem que ter todos os arquivos jars que estao no subdiretorio LIB do iReport ( acho que nem todos, tem q ver qual o jasper realmente usa ) e coloca-lo no seu classpath.

Abraços,

Criado 10 de fevereiro de 2004
Ultima resposta 10 de fev. de 2004
Respostas 1
Participantes 2