当前位置: 首页 > 知识库问答 >
问题:

JRXML加载异常

东郭存
2023-03-14

当我试图加载jrxml文件时,它会抛出下面的异常;

    net.sf.jasperreports.engine.JRException: org.xml.sax.SAXException:     http://java.sun.com/xml/jaxp/properties/schemaSource
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:300)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:283)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:272)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:246)
    at com.ocs.cwb.view.ControllerCWBHome.generate_report(ControllerCWBHome.java:549)
    at com.ocs.cwb.view.ControllerCWBHome.access$19(ControllerCWBHome.java:529)
    at com.ocs.cwb.view.ControllerCWBHome$3.handle(ControllerCWBHome.java:252)
    at com.ocs.cwb.view.ControllerCWBHome$3.handle(ControllerCWBHome.java:1)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at javafx.event.Event.fireEvent(Unknown Source)
    at javafx.scene.Node.fireEvent(Unknown Source)
    at javafx.scene.control.Button.fire(Unknown Source)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(Unknown Source)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(Unknown Source)
    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(Unknown Source)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
    at com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
    at javafx.event.Event.fireEvent(Unknown Source)
    at javafx.scene.Scene$MouseHandler.process(Unknown Source)
    at javafx.scene.Scene$MouseHandler.access$1500(Unknown Source)
    at javafx.scene.Scene.impl_processMouseEvent(Unknown Source)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$350(Unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$$Lambda$154/20031384.get(Unknown Source)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(Unknown Source)
    at com.sun.glass.ui.View.handleMouseEvent(Unknown Source)
    at com.sun.glass.ui.View.notifyMouse(Unknown Source)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$145(Unknown Source)
    at com.sun.glass.ui.win.WinApplication$$Lambda$36/3326003.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: org.xml.sax.SAXException: http://java.sun.com/xml/jaxp/properties/schemaSource
    at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1203)
    at org.apache.commons.digester.Digester.parse(Digester.java:1647)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:296)
    ... 64 more
try {
        JasperDesign jasperDesign = JRXmlLoader
                .load(new FileInputStream(
                        "I:/Projects/Sample/src/com/sam/cwp/report/sapmle.jrxml"));

        String sqlString = "SELECT*FROM Sample WHERE CNO= '156801'";
        JRDesignQuery designQuery = new JRDesignQuery();
        designQuery.setText(sqlString);
        jasperDesign.setQuery(designQuery);

        JasperReport jasperReport = JasperCompileManager
                .compileReport(jasperDesign);
        JasperPrint jasperPrint = JasperFillManager.fillReport(
                jasperReport, null, conn);

        JasperViewer.viewReport(jasperPrint);

    } catch (JRException e) {
        e.printStackTrace();
        System.out.println(e);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    <?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.0.3.final using JasperReports Library version 6.0.3  -->
<!-- 2015-04-18T10:44:56 -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="Sample" pageWidth="720" pageHeight="360" orientation="Landscape" columnWidth="300" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0" uuid="f4d80783-e43a-4696-8470-2175aa6d0130">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="MSSQL"/>
    <queryString>
        <![CDATA[SELECT * FROM sample]]>
    </queryString>
    <field name="ID" class="java.math.BigDecimal"/>
    <field name="OID" class="java.lang.String"/>
    <field name="CNO" class="java.lang.String"/>
    <field name="CUST_NO" class="java.lang.String"/>
    <field name="PAYMENT" class="java.lang.String"/>
    <field name="SHIPPHONENO" class="java.lang.String"/>
    <field name="SHIPCNA" class="java.lang.String"/>
    <field name="SHIPADDR1" class="java.lang.String"/>
    <field name="SHIPADDR2" class="java.lang.String"/>
    <field name="SHIPADDR3" class="java.lang.String"/>
    <field name="SHIPADDR4" class="java.lang.String"/>
    <field name="SHIPCOUNTRYID" class="java.lang.String"/>
    <field name="SHIPPOSTALCODE" class="java.lang.String"/>
    <field name="CONCNA" class="java.lang.String"/>
    <field name="CONPHONENO" class="java.lang.String"/>
    <field name="CONADDR1" class="java.lang.String"/>
    <field name="CONADDR2" class="java.lang.String"/>
    <field name="CONADDR3" class="java.lang.String"/>
    <field name="CONADDR4" class="java.lang.String"/>
    <field name="CONCOUNTRYID" class="java.lang.String"/>
    <field name="CONPOSTALCODE" class="java.lang.String"/>
    <field name="COPIES" class="java.lang.String"/>
    <field name="ATTN" class="java.lang.String"/>
    <field name="CONTENTS" class="java.lang.String"/>
    <field name="BFLYERS" class="java.lang.String"/>
    <field name="SFLYERS" class="java.lang.String"/>
    <field name="RUSER" class="java.lang.String"/>
    <field name="RDATE" class="java.lang.String"/>
    <field name="RTIME" class="java.lang.String"/>
    <field name="REMARKS" class="java.lang.String"/>
    <field name="PSTATUS" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <title>
        <band height="127" splitType="Stretch">
            <textField>
                <reportElement x="81" y="44" width="79" height="20" uuid="48454381-ce78-46c8-a445-ffe05c226610">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CNO}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="161" y="44" width="79" height="20" uuid="bc98f264-765e-4dd4-b32b-3571eb12e0cb">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CUST_NO}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement x="240" y="44" width="59" height="20" uuid="f82b9de0-aaed-45aa-bc2a-e3d960f829b4">
                    <property name="local_mesure_unitx" value="pixel"/>
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <text><![CDATA[SIN]]></text>
            </staticText>
            <textField>
                <reportElement x="180" y="87" width="160" height="20" uuid="e09f0461-c93c-4efb-a7a5-e1178b882fe5">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="12"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPPHONENO}]]></textFieldExpression>
            </textField>
            <componentElement>
                <reportElement x="580" y="1" width="120" height="88" uuid="8c3a74c7-a14f-494d-92cc-0f4c8064a72e"/>
                <jr:QRCode xmlns:jr="http://jasperreports.sourceforge.net/jasperreports/components" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports/components http://jasperreports.sourceforge.net/xsd/components.xsd">
                    <jr:codeExpression><![CDATA["123456789"]]></jr:codeExpression>
                </jr:QRCode>
            </componentElement>
            <textField>
                <reportElement x="525" y="89" width="79" height="20" uuid="c1f28961-fe50-4c90-a9d7-9475edfa6fe9">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="12"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONPHONENO}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="342" y="108" width="262" height="18" uuid="cdb21b18-d208-421e-9841-776825e9b167">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="15"/>
                <textElement verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONCNA}]]></textFieldExpression>
            </textField>
        </band>
    </title>
    <pageHeader>
        <band height="81" splitType="Stretch">
            <property name="local_mesure_unitheight" value="pixel"/>
            <property name="com.jaspersoft.studio.unit.height" value="px"/>
            <textField>
                <reportElement x="82" y="-18" width="258" height="18" uuid="0b9f5c28-9144-4e67-a491-a5ac4c1dce57">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="15"/>
                <textElement verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPCNA}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="82" y="0" width="258" height="18" uuid="6e1c4175-44fe-44aa-ad1d-9d5301387e1d">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="15"/>
                <textElement verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPADDR1}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="82" y="16" width="258" height="18" uuid="2165d829-3d8e-46e2-b7e5-315a711da4a2">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="15"/>
                <textElement verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPADDR2}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="82" y="32" width="258" height="18" uuid="a473cae7-27cb-406b-a2ac-211534511e52">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="15"/>
                <textElement>
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPADDR3}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="341" y="1" width="263" height="18" uuid="8374ca3f-dd60-43fa-9d94-5db5f47c0710">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="15"/>
                <textElement verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONADDR1}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="341" y="19" width="263" height="18" uuid="c88adb09-5661-4de4-90d0-f4af13b0ecca">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="15"/>
                <textElement verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONADDR2}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="341" y="38" width="263" height="18" uuid="a2ff1dc4-0ebd-4cce-9628-593579ad6151"/>
                <box leftPadding="15"/>
                <textElement verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONADDR3}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="281" y="56" width="59" height="20" uuid="2c56986c-d177-4836-8eee-ab4fd1280ea2">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPPOSTALCODE}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="388" y="56" width="107" height="20" uuid="996aca66-df72-4dac-be6e-125941c8fa12">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONCOUNTRYID}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="548" y="56" width="57" height="20" uuid="628b380b-5972-41af-8917-8cd8a20e162c"/>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONPOSTALCODE}]]></textFieldExpression>
            </textField>
        </band>
    </pageHeader>
    <columnHeader>
        <band height="151" splitType="Stretch">
            <textField>
                <reportElement x="128" y="-25" width="100" height="20" uuid="bab39829-f073-4973-9d70-9b0afa8c2e14">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{SHIPCOUNTRYID}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="351" y="110" width="174" height="-5" uuid="165a74a0-c477-4df0-8796-2f35f513eecb">
                    <property name="local_mesure_unitheight" value="pixel"/>
                    <property name="com.jaspersoft.studio.unit.height" value="px"/>
                </reportElement>
                <box leftPadding="10"/>
                <textElement verticalAlignment="Middle">
                    <font size="13"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{CONADDR3}]]></textFieldExpression>
            </textField>
        </band>
    </columnHeader>
</jasperReport>

共有1个答案

韶和璧
2023-03-14

我希望这是由于jasper源文件中的造成的。我也面临这个问题。每当我试图在报表中插入QR代码时,如果Jasper版本低于6.0,Jasper就会抛出SAX异常。即使使用Jasper Studio V6.0.4,它也会生成空白报告。

我希望这是jasper的一个公开问题,我在jasper社区找到了它。http://community.jaspersoft.com/jasperreports-server/issues/4681

 类似资料:
  • 它抛出以下错误:

  • 有人知道吗? PS:我正在使用iReport 5(甚至尝试了4)和DynamicJasper 3.1.8。

  • 问题内容: 我遇到了一个我绝对无法独自解决的问题,因为我刚刚开始使用JAVA FX。我得到了一个讨厌的javafx.fxml.LoadException:,但是我的操作完全像一个指南,但是我无法运行Main。这是异常输出: LoginController.java LoginGUI.fxml 和Main.java 问题答案: 问题出在源头 因此,您必须将其更改为适当的 这样做,在这里编辑fxml文

  • 问题内容: 我正在使用JQuery的几个插件,自定义窗口小部件和其他一些库。结果,我有几个.js和.css文件。我需要为网站创建一个加载器,因为加载需要一些时间。如果可以在导入所有内容之前显示加载程序,那就太好了: 我找到了一些教程,这些教程使我能够异步导入JavaScript库。例如,我可以做类似的事情: 由于某种原因,当我对所有文件执行相同操作时,页面将无法正常工作。我已经尝试了很长时间,试图

  • 问题内容: 我在 Java 应用程序中使用 JasperReports 。 __ 我有一个名为“ reports”的包,用于存储所有生成的报告。这是我在应用程序中调用jasper报告的方式。 可以了 我没有给出完整的路径,而是尝试了: 但这在运行程序时显示错误: 不适合提供 JRXmlLoader 的完整路径,因为如果要在其他计算机上运行此应用程序,则必须根据计算机路径更改所有编码。所以帮我 问题

  • 本文向大家介绍JavaScript异步加载方案相关面试题,主要包含被问及JavaScript异步加载方案时的应答技巧和注意事项,需要的朋友参考一下