| Autor |
Mensagem |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 24/08/2006 16:57:29
|
leandro_bortolotto
Debugger
Membro desde: 25/05/2006 16:43:41
Mensagens: 60
Offline
|
Pessoal,
Eu estou fazendo relatórios usando JasperReports e a ferramenta iReport para desenhar, consigo gerar os arquivos: .jasper, .jrprint e inclusive o .pdf (que é o resultado final) ele é gerado e os dados estão todos corretos, consigo abrir ele indo até o diretório em que se encontra.
O meu problema está ao tentar mostrar esse relatório através da minha aplicação, quando tento isso, resulta no seguinte erro:
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:87)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:64)
at net.sf.jasperreports.view.JRViewer.loadReport(JRViewer.java:1287)
at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:201)
at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:172)
at net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:140)
at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:397)
at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:328)
at br.com.cincodhortflor.relatorios.TesteJasper.metodo(TesteJasper.java:51)
at br.com.cincodhortflor.telas.TelaPrincipal$31.actionPerformed(TelaPrincipal.java:560)
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.BasicPopupMenuUI$Actions.doReturn(Unknown Source)
at javax.swing.plaf.basic.BasicPopupMenuUI$Actions.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.KeyboardManager.fireBinding(Unknown Source)
at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(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.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(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.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:87)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:64)
at net.sf.jasperreports.view.JRViewer.loadReport(JRViewer.java:1287)
at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:201)
at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:172)
at net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:140)
at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:397)
at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:328)
at br.com.cincodhortflor.relatorios.TesteJasper.metodo(TesteJasper.java:51)
at br.com.cincodhortflor.telas.TelaPrincipal$31.actionPerformed(TelaPrincipal.java:560)
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.BasicPopupMenuUI$Actions.doReturn(Unknown Source)
at javax.swing.plaf.basic.BasicPopupMenuUI$Actions.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.KeyboardManager.fireBinding(Unknown Source)
at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(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.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(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 : D:\arquivos java\eclipse\Caecp\relatoriosjasper\ClientesFisicos.pdf
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:92)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:64)
at net.sf.jasperreports.view.JRViewer.loadReport(JRViewer.java:1287)
at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:201)
at net.sf.jasperreports.view.JRViewer.<init>(JRViewer.java:172)
at net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:140)
at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:397)
at net.sf.jasperreports.view.JasperViewer.viewReport(JasperViewer.java:328)
at br.com.cincodhortflor.relatorios.TesteJasper.metodo(TesteJasper.java:51)
at br.com.cincodhortflor.telas.TelaPrincipal$31.actionPerformed(TelaPrincipal.java:560)
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.BasicPopupMenuUI$Actions.doReturn(Unknown Source)
at javax.swing.plaf.basic.BasicPopupMenuUI$Actions.actionPerformed(Unknown Source)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.KeyboardManager.fireBinding(Unknown Source)
at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source)
at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(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.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(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.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:87)
... 44 more
A classe para gerar o relatório é a seguinte:
O problema está na linha:
JasperViewer.viewReport( PathAplicacao.getPath("relatoriosjasper") + "ClientesFisicos.pdf", false );
Obs.: estou chamando este método através de um JMenuItem dentro de uma classe JFrame.
Desde já agradeço
|
Leandro Sehnem Bortolotto |
|
|
 |
|
|
![[Post New]](/templates/default/images/icon_minipost_new.gif) 24/08/2006 18:20:59
|
brlima
Moderador
![[Avatar]](/images/avatar/fc2c7c47b918d0c2d792a719dfb602ef.png)
Membro desde: 12/05/2003 14:03:38
Mensagens: 1537
Localização: São Paulo - SP
Offline
|
http://www.guj.com.br/posts/list/30/2778.java
|
Bruno R. Lima
-------------------------------------------
flickr :: twitter |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 25/08/2006 15:07:53
|
leandro_bortolotto
Debugger
Membro desde: 25/05/2006 16:43:41
Mensagens: 60
Offline
|
Consegui resolver o problema.
Na linha em que tinha o problema, deve ser trocado o tipo do arquivo, ao invés de tentar abrir o .pdf, devo tentar abrir o .jrprint, ai então vai abrir a janela com o relatório e depois é possível salvá-lo com outra extensão.
A linha correta é a seguinte:
|
Leandro Sehnem Bortolotto |
|
|
 |
![[Post New]](/templates/default/images/icon_minipost_new.gif) 04/01/2007 11:33:07
|
mdelazzeri
Smalltalk
Membro desde: 30/10/2006 13:36:28
Mensagens: 1
Offline
|
Pessoal.....
Preciso urgênte de uma ajuda......
Estou utlizando o JasperViewer para visualização do meu relatório. Eu não posso deixar o usuário imprimir, ou seja, tenho que desabilitar ou sumir com a impressora.
Alguém tem alguma idéia.
|
|
|
 |
|
|