2

I am getting this error while trying to compile a jrxml file that embeeds an html component : `net.sf.jasperreports.engine.JRRuntimeException: Unknown entity http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd, not loading.

My jrxml file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.1.1.final using JasperReports Library version 6.1.1  -->
<!-- 2015-11-25T00:02:30 -->
<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="template_Table" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="1a0aa80b-dc07-4dca-bdbc-aa78eeb0d12b">
    <detail>
        <band height="256" splitType="Stretch">
            <componentElement>
                <reportElement x="129" y="50" width="300" height="350" uuid="b346885c-8588-427f-b9f3-e262c34ce1ed"/>
                <hc:html xmlns:hc="http://jasperreports.sourceforge.net/htmlcomponent" xsi:schemaLocation="http://jasperreports.sourceforge.net/htmlcomponent http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd" scaleType="RetainShape" horizontalAlign="Left" verticalAlign="Middle">
                    <hc:htmlContentExpression><![CDATA[(new java.util.Scanner(new java.io.BufferedReader(new java.io.InputStreamReader(new java.net.URL("http://www.play-hookey.com/htmltest/result.html").openStream())))).useDelimiter("\\A").next()]]></hc:htmlContentExpression>
                </hc:html>
            </componentElement>
        </band>
    </detail>
</jasperReport>

My pom.xml :

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>jasperReports</groupId>
    <artifactId>helloWorld</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>helloWorld</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>net.sf.jasperreports</groupId>
            <artifactId>jasperreports</artifactId>
            <version>6.4.0</version>
        </dependency>

        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
        </dependency>

        <dependency>
            <groupId>com.lowagie</groupId>
            <artifactId>itext</artifactId>
            <version>2.1.7</version>
        </dependency>
        <dependency>
            <groupId>org.olap4j</groupId>
            <artifactId>olap4j</artifactId>
            <version>1.2.0</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>

I have tried to add jasperreports-htmlcomponent dependency as instructed here HTML Component issue: Failed to read schema document but the the dependency is not recognizable and it renders me instead an error message :

Missing artifact net.sf.jasperreports:jasperreports-htmlcomponent:jar:4.1.1

Any help will be more than welcome. Thank you in advance.

P.S. I am using JDK 1.7

User00
  • 111
  • 3
  • 13
  • 1
    You can look at this post: [Export html content to pdf using JasperReports](http://stackoverflow.com/q/1091760/876298) – Alex K Apr 12 '17 at 10:29
  • Thanks for your answer. The problem persists though. The xml scheme http://jasperreports.sourceforge.net/xsd/htmlcomponent.xsd is still unrecognizable. – User00 Apr 12 '17 at 10:40
  • As you can see my template from the post (answer) is similar to your. Should work. Did you add *jar* to cp? – Alex K Apr 12 '17 at 10:47
  • I did not pay attention to you mentioning the jar path. It worked. Thank you. However, this does solve my problem only partially since it does not work when I add the jar dependency into my pom. What should I do please? – User00 Apr 12 '17 at 11:02
  • You can upload this jar as artifact (for example at your local repo) and use it at pom.xml – Alex K Apr 12 '17 at 11:12

0 Answers0