How to refer to a .jrtx template file from Jasper Report (.jrxml)?
<p>I am using <a href="http://www.tutorialspoint.com/jasper_reports/jasper_report_styles.htm" rel="nofollow">this example</a> to apply a jasper template to jasper report. I am not able to find out how can I refer to jasper template from .jrxml file. The .jrxml file and .jrtx file are at the same location. In the Jasper I am referring to the template using following syntax. </p>

<pre><code>&lt;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="QCReport" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20"
              topMargin="20" bottomMargin="20" uuid="0ea707c5-78f5-4f37-a065-a228202cb59e"&gt;
    &lt;property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/&gt;
    &lt;import value="org.apache.commons.lang.StringUtils"/&gt;
    ..
    &lt;template&gt;&lt;![CDATA["JasperCustomStyle.jrtx"]]&gt;&lt;/template&gt;
    ..
</code></pre>

<p>But it gives me  <code>Byte data not found at: JasperCustomStyle.jrtx.</code> exception. Can someone please help me figure out how to refer to a jasper template from .jrxml file? </p>

<p>Detailed Exception</p>

<pre><code>Caused by: net.sf.jasperreports.engine.JRException: Byte data not found at: JasperCustomStyle.jrtx.
    at net.sf.jasperreports.repo.RepositoryUtil.getBytesFromLocation(RepositoryUtil.java:210)
    at net.sf.jasperreports.engine.xml.JRXmlTemplateLoader.loadTemplate(JRXmlTemplateLoader.java:106)
    at net.sf.jasperreports.engine.fill.JRFillReportTemplate.loadTemplate(JRFillReportTemplate.java:111)
    at net.sf.jasperreports.engine.fill.JRFillReportTemplate.evaluate(JRFillReportTemplate.java:89)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.collectTemplates(JRBaseFiller.java:740)
</code></pre>

<p>The jrtx file looks like below.</p>

<pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE jasperTemplate PUBLIC "-//JasperReports//DTD Template//EN" "http://jasperreports.sourceforge.net/dtds/jaspertemplate.dtd"&gt;

&lt;jasperTemplate&gt;
    &lt;style name="New style" mode="Opaque" forecolor="#000000" backcolor="#FFC800" fill="Solid" hAlign="Center" vAlign="Middle" isBold="true" isUnderline="true"&gt;
        &lt;box&gt;
            &lt;topPen lineWidth="1.0"/&gt;
            &lt;leftPen lineWidth="1.0"/&gt;
            &lt;bottomPen lineWidth="1.0"/&gt;
            &lt;rightPen lineWidth="1.0"/&gt;
        &lt;/box&gt;
    &lt;/style&gt;
&lt;/jasperTemplate&gt;
</code></pre>