Pessoal, alguém poderia me dizer o que é esse erro? Já vasculhei a net e não encontrei nada:
init:
deps-jar:
compile-single:
run-single:
Exception in thread "main" java.io.InvalidClassException: net.sf.jasperreports.engine.base.JRBaseReport; local class incompatible: stream classdesc serialVersionUID = 10200, local class serialVersionUID = 606
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:546)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:86)
at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:271)
at Relatorios.RelatorioCategoria.geraRelatorio(RelatorioCategoria.java:41)
at Relatorios.RelatorioCategoria.main(RelatorioCategoria.java:46)
NESTED BY :
net.sf.jasperreports.engine.JRException: Error loading object from file : src\RelatorioLancamentos.jasper
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:90)
at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:271)
at Relatorios.RelatorioCategoria.geraRelatorio(RelatorioCategoria.java:41)
at Relatorios.RelatorioCategoria.main(RelatorioCategoria.java:46)
Caused by: java.io.InvalidClassException: net.sf.jasperreports.engine.base.JRBaseReport; local class incompatible: stream classdesc serialVersionUID = 10200, local class serialVersionUID = 606
at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:546)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1699)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:86)
... 3 more
Java Result: 1
CONSTRUÍDO COM SUCESSO (tempo total: 1 segundo)
O Código do meu arquivo de geração de relatórios é esse:
package Relatorios;
import java.sql.*;
import java.util.HashMap;
import java.util.Map;
import net.sf.jasperreports.engine.JRResultSetDataSource;
import net.sf.jasperreports.engine.*;
import net.sf.jasperreports.view.JasperViewer;
public class RelatorioCategoria {
private static Connection getConnection() throws ClassNotFoundException, SQLException{
String driver = "org.gjt.mm.mysql.Driver";
String url = "jdbc:mysql://localhost/fazenda";
String usuario = "root";
String senha = "root";
Connection conexao;
Statement statement;
ResultSet resultset;
Class.forName(driver);
conexao = DriverManager.getConnection(url,usuario,senha);
return conexao;
}
public void geraRelatorio() throws JRException, ClassNotFoundException, SQLException{
Connection con = getConnection();
Statement stm = con.createStatement();
String query = "select * from categoriaanimal";
ResultSet rs = stm.executeQuery( query );
JRResultSetDataSource jrRs = new JRResultSetDataSource(rs);
Map parameters = new HashMap();
JasperFillManager.fillReportToFile("src//RelatorioLancamentos.jasper", parameters, jrRs );
JasperExportManager.exportReportToPdfFile("RelatorioLancamentos.jrprint");
JasperViewer.viewReport( "RelatorioLancamentos.pdf", false );
}
public static void main(String[] args) throws JRException, ClassNotFoundException, SQLException{
new RelatorioCategoria().geraRelatorio();
}
}