java 运行报告时警告:发现命名空间的两个组件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17670456/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Warning while Running report: Found two components for namespace
提问by syaloom
I have problem with report using JasperReports. I ran report on my program, it works, but there were error message just like this
我在使用JasperReports进行报告时遇到问题。我对我的程序运行了报告,它可以工作,但是有这样的错误消息
net.sf.jasperreports.engine.component.ComponentsEnvironment findComponentBundles
WARNING: Found two components for namespace http://jasperreports.sourceforge.net/jasperreports/components
WARNING: Found two components for namespace http://jasperreports.sourceforge.net/jasperreports/components
When I searched any recommendation as same as mine, none is solution. Do you know how to fix this?
当我搜索任何与我相同的建议时,没有一个是解决方案。你知道如何解决这个问题吗?
This' jrxml file
这个'jrxml文件
<?xml version="1.0" encoding="UTF-8"?>
<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="imp1_bln" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20">
<property name="ireport.zoom" value="1.0"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="thn_proses" class="java.lang.String"/>
<parameter name="bln_proses" class="java.lang.Integer"/>
<queryString>
<![CDATA[SELECT DISTINCT
m_negara."id_negara" AS ID_Negara,
m_negara."nama_negara" AS Nama_Negara,
import_det."netto_hs" AS Curr_Net,
SUM(import_det.netto_hs)AS Cumm_Net,
import_det."cif_hs_us" AS Curr_CIF,
SUM(import_det.cif_hs_us)AS Cumm_CIF,
batch_hdr."bln_proses" AS batch_hdr_bln_proses,
batch_hdr."thn_proses" AS batch_hdr_thn_proses
FROM
m_hs10digit, m_negara, import_det, batch_hdr, import
WHERE
"dbo".import.negara_pemasok=dbo.m_negara.id_negara AND dbo.import_det.sk_import=dbo.import.sk_import
AND dbo.import.sk_batch=dbo.batch_hdr.sk_batch
AND dbo.batch_hdr.bln_proses between 01 and $P{bln_proses}
GROUP BY
m_negara."id_negara",
m_negara."nama_negara",
import_det."netto_hs",
import_det."cif_hs_us",
batch_hdr."bln_proses",
batch_hdr."thn_proses"]]>
</queryString>
<field name="ID_Negara" class="java.lang.String"/>
<field name="Nama_Negara" class="java.lang.String"/>
<field name="Curr_Net" class="java.lang.Double"/>
<field name="Cumm_Net" class="java.lang.Double"/>
<field name="Curr_CIF" class="java.lang.Double"/>
<field name="Cumm_CIF" class="java.lang.Double"/>
<background>
<band splitType="Stretch"/>
</background>
<title>
<band height="93" splitType="Stretch">
<image>
<reportElement x="1" y="2" width="146" height="91"/>
<imageExpression class="java.lang.String"><![CDATA["coffee.jpg"]]></imageExpression>
</image>
<staticText>
<reportElement x="146" y="58" width="410" height="35"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" isItalic="false" pdfFontName="Times-Roman"/>
</textElement>
<text><![CDATA[Tabel Impor Menurut Negara Asal (Import By Country of Origin)]]></text>
</staticText>
</band>
</title>
<pageHeader>
<band height="35" splitType="Stretch"/>
</pageHeader>
<columnHeader>
<band height="79" splitType="Stretch">
<staticText>
<reportElement x="0" y="0" width="41" height="19"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" pdfFontName="Times-Roman"/>
</textElement>
<text><![CDATA[Bulan :]]></text>
</staticText>
<staticText>
<reportElement x="64" y="0" width="39" height="19"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font fontName="Times New Roman" size="12" pdfFontName="Times-Roman"/>
</textElement>
<text><![CDATA[Tahun:]]></text>
</staticText>
<staticText>
<reportElement x="0" y="40" width="56" height="39"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Kode Negara]]></text>
</staticText>
<staticText>
<reportElement x="146" y="59" width="90" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Bulan Ini]]></text>
</staticText>
<staticText>
<reportElement x="235" y="59" width="129" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Kumulatif]]></text>
</staticText>
<staticText>
<reportElement x="55" y="40" width="92" height="39"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Negara Asal]]></text>
</staticText>
<staticText>
<reportElement x="363" y="59" width="50" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Bulan Ini]]></text>
</staticText>
<staticText>
<reportElement x="412" y="59" width="144" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Kumulatif]]></text>
</staticText>
<staticText>
<reportElement x="146" y="40" width="218" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Berat Bersih (Netto)]]></text>
</staticText>
<staticText>
<reportElement x="363" y="40" width="193" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[CIF (US $)]]></text>
</staticText>
<textField>
<reportElement x="102" y="0" width="35" height="19"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.String"><![CDATA[$P{thn_proses}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="40" y="0" width="25" height="19"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.Integer"><![CDATA[$P{bln_proses}]]></textFieldExpression>
</textField>
</band>
</columnHeader>
<detail>
<band height="32" splitType="Stretch">
<textField>
<reportElement x="1" y="-1" width="55" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{ID_Negara}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="146" y="-1" width="90" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{Curr_Net}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="235" y="-1" width="129" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{Cumm_Net}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="55" y="-1" width="92" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.String"><![CDATA[$F{Nama_Negara}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="363" y="0" width="50" height="19"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{Curr_CIF}]]></textFieldExpression>
</textField>
<textField>
<reportElement x="412" y="-1" width="144" height="20"/>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression class="java.lang.Double"><![CDATA[$F{Cumm_CIF}]]></textFieldExpression>
</textField>
</band>
</detail>
<columnFooter>
<band height="45" splitType="Stretch"/>
</columnFooter>
<pageFooter>
<band height="54" splitType="Stretch"/>
</pageFooter>
<summary>
<band height="42" splitType="Stretch"/>
</summary>
</jasperReport>
回答by Victor G
It means that you have several jarfiles in your JasperReports Library classpath... just use:
这意味着您的 JasperReports 库类路径中有几个jar文件...只需使用:
- commons-beanutils-1.8.0
- commons-collections-2.1.1
- commons-digester-1.7
- commons-javaflow-20060411
- commons-logging-1.0.4
- groovy-all-1.7.5
- iText-2.1.7
- jasperreports-4.5.0 (any version)
- png-encoder-1.5
- poi-3.7-20101029 (Or poi-3.6)
- commons-beanutils-1.8.0
- commons-collections-2.1.1
- commons-digester-1.7
- 公共-javaflow-20060411
- commons-logging-1.0.4
- groovy-all-1.7.5
- iText-2.1.7
- jasperreports-4.5.0(任何版本)
- png-编码器-1.5
- poi-3.7-20101029(或 poi-3.6)
and problem solved...
和问题解决了...
回答by dalyc
The jasperreports-maven-plugin repeats the jasperreports dependency. I had your problem when I changed the version of my jasperreports dependency but did not also change it in the dependency of the jasperreports-maven-plugin.
jasperreports-maven-plugin 重复了 jasperreports 依赖项。当我更改 jasperreports 依赖项的版本但没有在 jasperreports-maven-plugin 的依赖项中更改它时,我遇到了您的问题。
回答by Arthur bauer
Just delete jasperreports-javaflow*.jar from your classpath during report compilation.
The error should disappear.
只需在报告编译期间从您的类路径中删除 jasperreports-javaflow*.jar。
错误应该消失。
回答by Hemantha
For the latest downloadable jasper jar zip(Japsperreports-6.3.0.jar) it does not provide all the needed jar files.You have to find the jar files. For eliminate issues just add
对于最新的可下载 jasper jar zip(Japsperreports-6.3.0.jar),它没有提供所有需要的 jar 文件。您必须找到 jar 文件。为了消除问题,只需添加
jasperreports-6.3.0.jar , org.apache.commons.collections.jar , commons-logging-1.2.jar , commons-digester-2.1.jar , commons-beanutils-1.8.3.jar ,
jasperreports-6.3.0.jar、org.apache.commons.collections.jar、commons-logging-1.2.jar、commons-digester-2.1.jar、commons-beanutils-1.8.3.jar、
will work fine..
会工作得很好..
回答by Eido Shack
I updated primefaces jar file from 3.5 to 4.0. It is solved the problem.
我将 primefaces jar 文件从 3.5 更新到 4.0。它解决了问题。