Ae galera,
Está dando este erro qunado eu clico no botão de gerar relatório de minha aplicação, alguém sabe o que é?
[code]java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.(Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:128)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:106)
at net.sf.jasperreports.view.JRViewer.loadReport(JRViewer.java:1270)
at net.sf.jasperreports.view.JRViewer.(JRViewer.java:172)
at net.sf.jasperreports.view.JasperViewer.(JasperViewer.java:161)
at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:297)
at Principal$8.actionPerformed(Principal.java:326)
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.plaf.basic.BasicButtonListener.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.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.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.(Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:128)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:106)
at net.sf.jasperreports.view.JRViewer.loadReport(JRViewer.java:1270)
at net.sf.jasperreports.view.JRViewer.(JRViewer.java:172)
at net.sf.jasperreports.view.JasperViewer.(JasperViewer.java:161)
at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:297)
at Principal$8.actionPerformed(Principal.java:326)
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.plaf.basic.BasicButtonListener.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.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:\Arq_projeto\RelatorioTeste.pdf
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:133)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:106)
at net.sf.jasperreports.view.JRViewer.loadReport(JRViewer.java:1270)
at net.sf.jasperreports.view.JRViewer.(JRViewer.java:172)
at net.sf.jasperreports.view.JasperViewer.(JasperViewer.java:161)
at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:297)
at Principal$8.actionPerformed(Principal.java:326)
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.plaf.basic.BasicButtonListener.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.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.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.(Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:128)
… 29 more[/code]
Este é o trecho do código:try{
Conexao con = new Conexao();
Statement FluxoSQL = con.conexao.createStatement();
ResultSet Resultados = FluxoSQL.executeQuery("SELECT * FROM Tab_Clientes");
Resultados.next();
JRResultSetDataSource jrRS = new JRResultSetDataSource(Resultados);
Map parameters = new HashMap();
/* Preenche o relatório com os dados. Gera o arquivo BibliotecaPessoal.jrprint */
JasperFillManager.fillReportToFile("C:\\Arq_projeto\\RelatorioTeste.jasper", parameters, jrRS );
/* Exporta para o formato PDF */
JasperExportManager.exportReportToPdfFile("C:\\Arq_projeto\\RelatorioTeste.jrprint" );
/* Preenche o relatorio e o salva diretamente em arquivo PDF. Sem a necessidade do .jrprint */
/* Visualiza o relatório em formato PDF */
JasperViewer.viewReport("C:\\Arq_projeto\\RelatorioTeste.pdf", false );
}
catch(Exception ex){
System.err.println("Erro no acesso ao banco de dados !");
ex.printStackTrace();
}
Valeu! 8)