你能帮我解决这个错误信息吗?

时间:2014-04-23 04:01:57

标签: java netbeans ireport

加载报告模板时出错

消息:

  

net.sf.jasperreports.engine.JRException:org.xml.sax.SAXParseException; lineNumber:145; columnNumber:39;   cvc-complex-type.2.4.d:找到无效的内容   元素'段落'。此时不会有子元素。   水平:       严重堆栈跟踪:org.xml.sax.SAXParseException; lineNumber:145; columnNumber:39; cvc-complex-type.2.4.d:内容无效   从元素'段落开始找到。预计不会有子元素   在此刻。       net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243)       net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)       net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)       com.jaspersoft.ireport.designer.JrxmlLoader.reloadJasperDesign(JrxmlLoader.java:73)       com.jaspersoft.ireport.designer.JrxmlVisualView.run(JrxmlVisualView.java:512)       org.openide.util.RequestProcessor $ Task.run(RequestProcessor.java:1432)       org.openide.util.RequestProcessor $ Processor.run(RequestProcessor.java:2042)   cvc-complex-type.2.4.d:找到无效的内容   元素'段落'。此时不会有子元素。       com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)       com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)       com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)       com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)       com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)       com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator $ XSIErrorReporter.reportError(XMLSchemaValidator.java:458)       com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3237)       com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1800)       com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:766)       com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:355)       com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl $ FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2770)       com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)       com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:117)       com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)       com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)       com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)       com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)       com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)       com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl $ JAXPSAXParser.parse(SAXParserImpl.java:649)       org.apache.commons.digester.Digester.parse(Digester.java:1647)       net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:239)       net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)       net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)       com.jaspersoft.ireport.designer.JrxmlLoader.reloadJasperDesign(JrxmlLoader.java:73)       com.jaspersoft.ireport.designer.JrxmlVisualView.run(JrxmlVisualView.java:512)       org.openide.util.RequestProcessor $ Task.run(RequestProcessor.java:1432)       org.openide.util.RequestProcessor $ Processor.run(RequestProcessor.java:2042)

错误讯息:

  

SQL错误(1064):您的SQL语法中有错误;查看与您的MySQL服务器版本相对应的手册,以获得在''附近使用的正确语法。在第12行

1 个答案:

答案 0 :(得分:1)

您正在尝试使用默认语句终止符;分号终止的多个可执行语句来编译存储过程。

定义自定义delimiter并使用它发送给编译器。这样编译器就可以将整个主体理解为具有多个语句的代码块

示例

delimiter //

CREATE PROCEDURE aProce()
BEGIN
    SELECT
        th.NAME,
        th.PRICEBUY,
        th.PRICESELL,
        p.DATENEW
    FROM shop.stockdiary AS p
    JOIN shop.products AS th where
        th.id = p.Product;
END;

//

delimiter ;

<强>替代地
这仅适用于过程体中存在单个可执行语句的情况。

CREATE PROCEDURE aProce()
    SELECT
        th.NAME,
        th.PRICEBUY,
        th.PRICESELL,
        p.DATENEW
    FROM shop.stockdiary AS p
    JOIN shop.products AS th where
        th.id = p.Product;