| |||
JasperReport Estoy realizando un reporte en NetBeans 6.0 .1 y saque un ejemplo de este foro para llamar a un reporte desde un boton JasperReport jasperReport; JasperPrint jasperPrint; Connection con = null; try { Class.forName("com.mysql.jdbc.Driver"); con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/Test","",""); //1-Compilamos el archivo XML y lo cargamos en memoria System.out.println("paso"); jasperReport = JasperCompileManager.compileReport("E:/Ingrid/GestionPedidos/src/reporte.jrxml"); //2-Llenamos el reporte con la información y parámetros necesarios jasperPrint = JasperFillManager.fillReport(jasperReport, new HashMap(), con); //3-Exportamos el reporte a pdf y lo guardamos en disco JasperExportManager.exportReportToPdfFile( jasperPrint, "c:/reporte.pdf"); } catch (ClassNotFoundException ex) { Logger.getLogger(JFPedidos.class.getName()).log(Le vel.SEVERE, null, ex); } catch (SQLException ex) { Logger.getLogger(JFPedidos.class.getName()).log(Le vel.SEVERE, null, ex); } catch (JRException e) { e.printStackTrace(); } cuando compilo me tira este error: 15-jul-2009 14:47:18 org.apache.commons.digester.Digester error GRAVE: Parse Error at line 2 column 416: Document root element "jasperReport", must match DOCTYPE root "null". org.xml.sax.SAXParseException: Document root element "jasperReport", must match DOCTYPE root "null". at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.createSAXParseException(ErrorHandlerWrap per.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandl erWrapper.error(ErrorHandlerWrapper.java:131) at com.sun.org.apache.xerces.internal.impl.XMLErrorRe porter.reportError(XMLErrorReporter.java:384) at com.sun.org.apache.xerces.internal.impl.XMLErrorRe porter.reportError(XMLErrorReporter.java:318) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTD Validator.rootElementSpecified(XMLDTDValidator.jav a:1621) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTD Validator.handleStartElement(XMLDTDValidator.java: 1900) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTD Validator.startElement(XMLDTDValidator.java:764) at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanStartElement(XMLDocumentF ragmentScannerImpl.java:1359) at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl$ContentDriver.scanRootElementHook(XML DocumentScannerImpl.java:1316) at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl$FragmentContentDriver.next(XM LDocumentFragmentScannerImpl.java:3095) at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl$PrologDriver.next(XMLDocumentScannerI mpl.java:921) at com.sun.org.apache.xerces.internal.impl.XMLDocumen tScannerImpl.next(XMLDocumentScannerImpl.java:648) at com.sun.org.apache.xerces.internal.impl.XMLDocumen tFragmentScannerImpl.scanDocument(XMLDocumentFragm entScannerImpl.java:510) at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:807) at com.sun.org.apache.xerces.internal.parsers.XML11Co nfiguration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLPars er.parse(XMLParser.java:107) at com.sun.org.apache.xerces.internal.parsers.Abstrac tSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserI mpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.commons.digester.Digester.parse(Digeste r.java:1647) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXM L(JRXmlLoader.java:239) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXM L(JRXmlLoader.java:226) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:214) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:168) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:152) at net.sf.jasperreports.engine.JasperCompileManager.c ompileReport(JasperCompileManager.java:151) at gestionpedidos.JFPedidos.btnImprimirActionPerforme d(JFPedidos.java:722) at gestionpedidos.JFPedidos.access$1400(JFPedidos.jav a:42) at gestionpedidos.JFPedidos$18.actionPerformed(JFPedi dos.java:455) at javax.swing.AbstractButton.fireActionPerformed(Abs tractButton.java:1995) at javax.swing.AbstractButton$Handler.actionPerformed (AbstractButton.java:2318) at javax.swing.DefaultButtonModel.fireActionPerformed (DefaultButtonModel.java:387) at javax.swing.DefaultButtonModel.setPressed(DefaultB uttonModel.java:242) at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(BasicButtonListener.java:236) at java.awt.Component.processMouseEvent(Component.jav a:6134) at javax.swing.JComponent.processMouseEvent(JComponen t.java:3265) at java.awt.Component.processEvent(Component.java:589 9) at java.awt.Container.processEvent(Container.java:202 3) at java.awt.Component.dispatchEventImpl(Component.jav a:4501) at java.awt.Container.dispatchEventImpl(Container.jav a:2081) at java.awt.Component.dispatchEvent(Component.java:43 31) at java.awt.LightweightDispatcher.retargetMouseEvent( Container.java:4301) at java.awt.LightweightDispatcher.processMouseEvent(C ontainer.java:3965) at java.awt.LightweightDispatcher.dispatchEvent(Conta iner.java:3895) at java.awt.Container.dispatchEventImpl(Container.jav a:2067) at java.awt.Window.dispatchEventImpl(Window.java:2458 ) at java.awt.Component.dispatchEvent(Component.java:43 31) at java.awt.EventQueue.dispatchEvent(EventQueue.java: 599) at java.awt.EventDispatchThread.pumpOneEventForFilter s(EventDispatchThread.java:269) at java.awt.EventDispatchThread.pumpEventsForFilter(E ventDispatchThread.java:184) at java.awt.EventDispatchThread.pumpEventsForHierarch y(EventDispatchThread.java:174) at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:169) at java.awt.EventDispatchThread.pumpEvents(EventDispa tchThread.java:161) at java.awt.EventDispatchThread.run(EventDispatchThre ad.java:122) net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException: Document root element "jasperReport", must match DOCTYPE root "null". at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXM L(JRXmlLoader.java:243) at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXM L(JRXmlLoader.java:226) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:214) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:168) at net.sf.jasperreports.engine.xml.JRXmlLoader.load(J RXmlLoader.java:152) at net.sf.jasperreports.engine.JasperCompileManager.c ompileReport(JasperCompileManager.java:151) si alguien sabe que puede ser, le agradeceria mucho su ayuda. |