Tengo el siguiente codigo en Java:
Conexion cc = new Conexion();
JasperReport jr = null;
String Path = "src/main/resources/Reportes/ReporteAlmuerzo1.jasper";
try {
jr = (JasperReport) JRLoader.loadObjectFromFile(Path);
Map<String, Object> parametros = new HashMap<String, Object>();
String fechaTabla = (String) TablaConduceAlmuerzo.getValueAt(1, 6);//Envio el parametro 6 (donde se encuentra la fecha)
int Grupo = Datos.Grupo;//Obtengo el grupo correspondiente
parametros.put("Fecha", fechaTabla);//Envio al fecha
parametros.put("Grupo", Grupo);//envio el grupo
JasperPrint jp = JasperFillManager.fillReport(jr, parametros, cc.getConnection());
JasperViewer jv = new JasperViewer(jp, false);
jv.setVisible(true);
jv.setTitle("Reportes");
} catch (JRException e) {
JOptionPane.showMessageDialog(null, "Error: " + e);
}
Tengo un reporte con el diseño hecho, el reprote puedo llamarlo desde Java siempre y cuando no le agregue una tabla, pero desde que le agrego una tabla (Lo necesito por obligación ya que necesito mostrar unos datos) me comienza a dar el sienguiente error:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:138)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:551)
at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:393)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:91)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:456)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:863)
at GenerarConduceAlmuerzo$7.actionPerformed(GenerarConduceAlmuerzo.java:419)
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.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(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)
En el Dataset he agregado las 2 variables que envio por parametros desde Java (pensando que esto lo solucionaria) y nada.
He igualado las variables del reporte con la del Dataset y tampoco me ha resultado, siempre me da el mismo error. ¿Alguna recomendación por favor?