Search code examples
jasper-reportsjasperserver

Invalid content was found starting with element 'hc:html' - newer versions solution?


When trying to deploy jrxml with hc:html I get the following error:

org.xml.sax.SAXParseException; lineNumber: 26; columnNumber: 277; cvc-complex-type.2.4.a: Invalid content was found starting with element 'hc:html'. One of '{"http://jasperreports.sourceforge.net/jasperreports":component}' is expected

Now I found duplicate questions but they are all related to old versions of jasper soft.

So my context is:

Jasper Soft Studio 5.6.0;

Server: 5.5.0

I don't have something like jasperreports-htmlcomponent-5.0.1.jar in my JasperSoftStudio package.

I've tried to add com.jaspersoft.studio.html_5.6.0.final.jar

But still get the exception..

Has anyone attempted to load report with html to the newer versions of jasper server?

That is how my directory looks like after I added the html jar.

root@jasper:/opt/jasperreports-server-cp-5.5.0/apache-tomcat/lib# ls -la
total 16864

drwxr-xr-x  2 root root    4096 Aug  4 11:41 .
drwxr-xr-x 10 root root    4096 Mar 18 10:21 ..
-rwxr-xr-x  1 root root   15264 Jul  2  2013 annotations-api.jar
-rwxr-xr-x  1 root root   54142 Jul  2  2013 catalina-ant.jar
-rwxr-xr-x  1 root root  134215 Jul  2  2013 catalina-ha.jar
-rwxr-xr-x  1 root root 1581311 Jul  2  2013 catalina.jar
-rwxr-xr-x  1 root root  257520 Jul  2  2013 catalina-tribes.jar
-rw-r--r--  1 root root 1238098 Aug  4 11:41 com.jaspersoft.studio.html_5.6.0.final.jar
-rwxr-xr-x  1 root root 3528544 Oct 24  2013 db2jcc-9.7.jar
-rwxr-xr-x  1 root root 1801636 Jul  2  2013 ecj-4.2.2.jar
-rwxr-xr-x  1 root root   46085 Jul  2  2013 el-api.jar
-rw-rw-rw-  1 root root 1473091 Jun  9 08:57 hsqldb-2.3.2.jar
-rwxr-xr-x  1 root root  385123 Oct 24  2013 ingres-jdbc-9.2.0.jar
-rwxr-xr-x  1 root root  123241 Jul  2  2013 jasper-el.jar
-rwxr-xr-x  1 root root  599428 Jul  2  2013 jasper.jar
-rwxr-xr-x  1 root root   88690 Jul  2  2013 jsp-api.jar
-rwxr-xr-x  1 root root  214918 Oct 24  2013 mariadb-java-client-1.1.2.jar
-rwxr-xr-x  1 root root 2152051 Oct 24  2013 ojdbc6-11.2.0.2.jar
-rwxr-xr-x  1 root root  548310 Oct 22  2012 postgresql-9.1-903.jdbc4.jar
-rwxr-xr-x  1 root root  579785 Oct 24  2013 postgresql-9.2-1002.jdbc4.jar
-rwxr-xr-x  1 root root  177598 Jul  2  2013 servlet-api.jar
-rwxr-xr-x  1 root root  584207 Oct 24  2013 sqljdbc-1.6-2206.100.jar
-rwxr-xr-x  1 root root    6873 Jul  2  2013 tomcat-api.jar
-rwxr-xr-x  1 root root  796527 Jul  2  2013 tomcat-coyote.jar
-rwxr-xr-x  1 root root  235411 Jul  2  2013 tomcat-dbcp.jar
-rwxr-xr-x  1 root root   77364 Jul  2  2013 tomcat-i18n-es.jar
-rwxr-xr-x  1 root root   48693 Jul  2  2013 tomcat-i18n-fr.jar
-rwxr-xr-x  1 root root   51678 Jul  2  2013 tomcat-i18n-ja.jar
-rwxr-xr-x  1 root root  124006 Jul  2  2013 tomcat-jdbc.jar
-rwxr-xr-x  1 root root   23201 Jul  2  2013 tomcat-util.jar
-rwxr-xr-x  1 root root  254163 Oct 24  2013 vertica_4.1.19_jdk_5.jar

Solution

  • The solution is to grab the a jar for the html component from Jasper Studio or iReport and then upload it to the server.

    Steps:

    1. Since newer version of Jasper Report Designer is Eclipse based - navigate to plugins folder.

    2. Find com.jaspersoft.studio.html_x.x.x.final.jar.

    3. Extract the contents of the jar to a folder.

    4. Grab a jar from within the lib folder of this jar. (Your_eclipse_distribution/plugins/com.jaspersoft.studio.html_5.6.0.final/lib/htmlcomponent.jar)

    5. Copy the library to your server /WEB-INF/lib (NOT the one I've shown in question).

    6. Restart Server

    It is quite weird that after so many years Jasper Server does not natively support embedded html and it is also weird that you have to lurk inside the report designer libraries and extract the jar manually. Not to mention that Jasper Server report viewer won't show you your report with html. Which leads me to conclusion that they make everything they can to make it inconvenient to work with CE.