Problema ao carregar um relatório!

5 respostas
mike_fv777

Se liga, montei essa classe aq para gerar um relatório q eu criei no Jasper Assistant do Eclipse ; ela usa um conection de outra classe interna aq da minha aplicação, e os .jasper e .jrxml q eu fiz estão no C:, ñ usei nada como parâmetro para q fossem gerados;
a classe eh essa aq:

/*

import java.sql.Connection;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.sql.Statement;

import java.util.HashMap;

import java.util.Map;

import net.sf.jasperreports.engine.JRException;

import net.sf.jasperreports.engine.JRResultSetDataSource;

import net.sf.jasperreports.engine.JasperFillManager;

import net.sf.jasperreports.engine.JasperPrint;

import net.sf.jasperreports.engine.JasperReport;

import net.sf.jasperreports.view.JasperViewer;

import firebird.BD;

public class RelGeralEquipamento {
private static Connection connection = BD.carregar();

public static void gerar() throws JRException, Exception, SQLException{

   Statement stm = connection.createStatement();
   String query = "select * from relequipamento";
   ResultSet rs = stm.executeQuery(query);
   Map parameters = new HashMap();
   String dir = "C:/";



   try {
       /*implementação da interface JRDataSource para DataSource

ResultSet */
JRResultSetDataSource jrRSLivros = new
JRResultSetDataSource(rs);

/*Preenche o relatório com os dados. Gera o arquivo

teste_report.jrprint*/
JasperFillManager.fillReportToFile(dir
+“eqp_report.jasper”, parameters, jrRSLivros)
;

/*Visualiza o relatório em formato PDF*/
       JasperViewer.viewReport(dir +"eqp_report.jrprint", false, false);
       rs.close();


   }
   catch (Exception e) {
      e.printStackTrace();
   }


         }

}

e tah dando um erro muito louco qdo eu tento carregar o método gerar ,
de outra classe da minha aplicação, eh esse erro gigantesco aq:

Conexão feita!

java.io.InvalidClassException:

net.sf.jasperreports.engine.base.JRBaseReport; local class

incompatible: stream classdesc serialVersionUID = 608, local class

serialVersionUID = 604

at java.io.ObjectStreamClass.initNonProxy(Unknown Source)

at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)

at java.io.ObjectInputStream.readClassDesc(Unknown Source)

at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)

at java.io.ObjectInputStream.readClassDesc(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)

at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.readObject(Unknown Source)

at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:129)

at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:314)

at Relatório.RelGeralEquipamento.gerar(RelGeralEquipamento.java:41)

at apresenta.Desktop$3.actionPerformed(Desktop.java:89)

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

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

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

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

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

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

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.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)
NESTED BY :

java.io.InvalidClassException:

net.sf.jasperreports.engine.base.JRBaseReport; local class

incompatible: stream classdesc serialVersionUID = 608, local class

serialVersionUID = 604

at java.io.ObjectStreamClass.initNonProxy(Unknown Source)

at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)

at java.io.ObjectInputStream.readClassDesc(Unknown Source)

at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)

at java.io.ObjectInputStream.readClassDesc(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)

at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.readObject(Unknown Source)

at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:129)

at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:314)

at Relatório.RelGeralEquipamento.gerar(RelGeralEquipamento.java:41)

at apresenta.Desktop$3.actionPerformed(Desktop.java:89)

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

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

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

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

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

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

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.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)
NESTED BY :

net.sf.jasperreports.engine.JRException: Error loading object from

file : C:\eqp_report.jasper

at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:133)

at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:314)

at Relatório.RelGeralEquipamento.gerar(RelGeralEquipamento.java:41)

at apresenta.Desktop$3.actionPerformed(Desktop.java:89)

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

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

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

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

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

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

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.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)

Caused by: java.io.InvalidClassException:

net.sf.jasperreports.engine.base.JRBaseReport; local class

incompatible: stream classdesc serialVersionUID = 608, local class

serialVersionUID = 604

at java.io.ObjectStreamClass.initNonProxy(Unknown Source)

at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)

at java.io.ObjectInputStream.readClassDesc(Unknown Source)

at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)

at java.io.ObjectInputStream.readClassDesc(Unknown Source)

at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)

at java.io.ObjectInputStream.readObject0(Unknown Source)

at java.io.ObjectInputStream.readObject(Unknown Source)

at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:129)

 29 more

Desd jah agradeço mto!!!
Flw e valeu!!

5 Respostas

mike_fv777

pow galera… várias vizualizações e nehuma resposta… :frowning:

Por favor, serah q ninguém pod me ajudar!?!?!?! :lol:

G

Tudo bem?

Esse tipo de problema ocorreu comigo quando eu criei um report no iReport e depois tentei utilizá-lo na minha aplicação.

Parece que a exceção

acontece quando você compila o relatório (.jasper) em uma ferramenta que possua uma versão diferente do pacote jasperreports-0.6..jar.

No caso do iReport, o que você deve fazer é copiar o arquvio *.jar pro diretório lib do iReport. Não sei como é no Eclipse, pois eu não o uso. Mas suspeito que seja algo parecido.

Espero que tenha ajudado…

Até mais,

Guilherme Hermeto

mike_fv777

Kra, mto obrigado msm pela ajuda!!!
Bom melhorou um pouco… Agpora tah dando esse erro aq:

Exception in thread AWT-EventQueue-0 java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

at net.sf.jasperreports.engine.fill.JRBaseFiller.(Unknown Source)

at net.sf.jasperreports.engine.fill.JRFiller.fillReport(Unknown Source)

at net.sf.jasperreports.engine.JasperFillManager.fillReport(Unknown Source)

at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(Unknown Source)

at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(Unknown Source)

at Relatório.RelGeralEquipamento.gerar(RelGeralEquipamento.java:45)

at apresenta.Desktop$3.actionPerformed(Desktop.java:89)

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

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

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

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

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

at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)

at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)

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.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)

Por favor … me ajudem :lol:

Brigadaum por td jah!

G

Bom, pararece que o compilador não conseguiu encontrar um dos pacotes que estava procurando.

Você tem que incluir no classpath da sua aplicação a localização dos pacotes que o Jasper precisa pra funcionar.

Vc fez download dos requsitos do Jasper???

Se você fez só precisa inclui-los no classpath, se não o fez:

fonte: http://jasperreports.sourceforge.net/requirements.html

Até mais,

Guilherme Hermeto

mike_fv777

Deixe ver se entendi :
Preciso baixar todos esses *.jar, incluir o caminho deles na variável de ambiente ( Classpath) do windows
(Meu Computador ->Propriedades -> Avançado -> Variáveis de Ambiente)

Eh isso?!??!?!

Mto obrigado gui.hermeto!!!

Criado 26 de julho de 2005
Ultima resposta 29 de jul. de 2005
Respostas 5
Participantes 2