Prezados, estou tendo problemas ao gerar um relatório usando o jasperReport 3.6.2.
tenho as seguintes bibliotecas:
commons-beanutils-1.8.0
commons-collections-3.2.1
commons-digester-1.7
commons-lang-2.4
commons-logging-1.1
groovy-all-1.5.5
iText-2.1.0
jasperreports-3.6.2
o erro que aparece é esse:
Exception in thread “AWT-EventQueue-0” java.lang.NullPointerException
at jcadastropendentes.jFPrincipal.jButton2ActionPerformed(jFPrincipal.java:2171)
at jcadastropendentes.jFPrincipal.access$300(jFPrincipal.java:36)
at jcadastropendentes.jFPrincipal$4.actionPerformed(jFPrincipal.java:243)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
at java.awt.Component.processMouseEvent(Component.java:6505)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
at java.awt.Component.processEvent(Component.java:6270)
at java.awt.Container.processEvent(Container.java:2229)
at java.awt.Component.dispatchEventImpl(Component.java:4861)
at java.awt.Container.dispatchEventImpl(Container.java:2287)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
at java.awt.Container.dispatchEventImpl(Container.java:2273)
at java.awt.Window.dispatchEventImpl(Window.java:2719)
at java.awt.Component.dispatchEvent(Component.java:4687)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:703)
at java.awt.EventQueue.access$000(EventQueue.java:102)
at java.awt.EventQueue$3.run(EventQueue.java:662)
at java.awt.EventQueue$3.run(EventQueue.java:660)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
at java.awt.EventQueue$4.run(EventQueue.java:676)
at java.awt.EventQueue$4.run(EventQueue.java:674)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:673)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:244)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:97)
alguem sabe como resolver?
abaixo segue meu código:
[code]try {
ClassConecta.conectajTorre();
} catch (SQLException ex) {
Logger.getLogger(jFPrincipal.class.getName()).log(Level.SEVERE, null, ex);
}
String caminhoRelJasper = "Relatorios/RUltimasFerias.jasper";
ResultSet rs = null;
try {
JRResultSetDataSource ds = new JRResultSetDataSource(rs);
URL arquivo = getClass().getResource(caminhoRelJasper);
if (arquivo == null)
JOptionPane.showMessageDialog(null,"Arquivo jasper não encontrado");
JasperReport report;
try {
report = JasperManager.loadReport(arquivo.openStream());
JasperPrint jasperPrint = JasperFillManager.fillReport(report, new HashMap(), ds);
JasperViewer jrviewer = new JasperViewer(jasperPrint, false);
jrviewer.setVisible(true);
} catch (JRException ex) {
Logger.getLogger(jFPessoas.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, "Erro ao gerar relatório", "Mensagem do sistema\n"+ex, JOptionPane.ERROR_MESSAGE);
}
} catch (IOException ex) {
Logger.getLogger(jFPessoas.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, "Erro ao gerar relatório\n"+ex, "Mensagem do sistema", JOptionPane.ERROR_MESSAGE);
}[/code]
Desde já agradeço a quem puder ajudar.