I am generating a report in Jasper Studio, where the main report has N sub reports, and one of those reports has a connection to a database other than the main report. When I run the main report in Jasper Studio the first time I get the following error:
Caused by: java.sql.SQLException: No suitable driver found for jdbc:postgresql://192.168.1.226:5432/BancoDados
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at gerenciamentoContratosTI_Master_1527160426610_582447.evaluate
(gerenciamentoContratosTI_Master_1527160426610_582447:241)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:250)
But if I go in this sub report and run it by myself (which works normally) and then run again the main report works normally, does anyone know what might be causing this?
AnotherthingInoticedisthatsometimesifthiserroroccursandItrytorunthesamereportagainwithoutchanginganythingtheerrordoesnotoccuragain,howeverwhenI'mtryingtogeneratethereportoutofJasperstudiotheerroralwaysoccursevenwhenrunningmoreatonce.
REPORTCODE
<?xmlversion="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version last-->
<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="gerenciamentoContratosTI_Master" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="31b1aa49-0fa2-4acf-9b60-510e34a327f8">
<property name="com.jaspersoft.studio.data.defaultdataadapter" value="conexaoMySQL"/>
<property name="com.jaspersoft.studio.unit." value="pixel"/>
<parameter name="empresaInicial" class="java.lang.String"/>
<parameter name="dataInicial" class="java.lang.String"/>
<parameter name="dataFinal" class="java.lang.String"/>
<parameter name="conteudoPrincipal" class="java.lang.String">
<defaultValueExpression><![CDATA["C:\Users\romualdo\JaspersoftWorkspace\MyReports\RelatoriosFinal\resumoTrimestral.jasper"]]></defaultValueExpression>
</parameter>
<parameter name="tempoTotal" class="java.lang.String">
<defaultValueExpression><![CDATA["C:\Users\romualdo\JaspersoftWorkspace\MyReports\RelatoriosFinal\tempoTotalTrimestre.jasper"]]></defaultValueExpression>
</parameter>
<parameter name="cabecalho" class="java.lang.String">
<parameterDescription><![CDATA[]]></parameterDescription>
<defaultValueExpression><![CDATA["C:\Users\romualdo\JaspersoftWorkspace\MyReports\RelatoriosFinal\dadosContratosTI.jasper"]]></defaultValueExpression>
</parameter>
<parameter name="empresaFinal" class="java.lang.String"/>
<parameter name="chamados" class="java.lang.String">
<defaultValueExpression><![CDATA["C:\Users\romualdo\JaspersoftWorkspace\MyReports\RelatoriosFinal\Chamados.jasper"]]></defaultValueExpression>
</parameter>
<parameter name="resumoMensal" class="java.lang.String">
<parameterDescription><![CDATA[]]></parameterDescription>
<defaultValueExpression><![CDATA["C:\Users\romualdo\JaspersoftWorkspace\MyReports\RelatoriosFinal\resumoMensal.jasper"]]></defaultValueExpression>
</parameter>
<parameter name="valorTotalRequisicoes" class="java.lang.String">
<defaultValueExpression><![CDATA["C:\Users\romualdo\JaspersoftWorkspace\MyReports\RelatoriosFinal\valorTotalRequisicoes.jasper"]]></defaultValueExpression>
</parameter>
<queryString language="SQL">
<![CDATA[SELECT
otrs.ticket.customer_id as EMPRESA,
(case when day(sysdate()) < 10 then MONTHNAME(STR_TO_DATE(Month(now()) -1,'%m')) else
MONTHNAME(STR_TO_DATE(Month(now()),'%m')) end) as mes
FROM
otrs.ticket,
otrs.users,
otrs.ticket_type,
otrs.ticket_state,
otrs.service,
otrs.time_accounting,
otrs.customer_company cc2
WHERE
cc2.valid_id = 1 and
cc2.customer_id = otrs.ticket.customer_id and
otrs.ticket.id = otrs.time_accounting.ticket_id and
otrs.ticket.user_id = otrs.users.id and
otrs.ticket.type_id = otrs.ticket_type.id and
otrs.ticket.ticket_state_id = otrs.ticket_state.id and
otrs.ticket.service_id = otrs.service.id and
/*otrs.ticket.change_time between '2018-02-01' and '2018-04-30' and*/
otrs.time_accounting.change_time between $P!{dataInicial} and $P!{dataFinal} and
otrs.ticket.customer_id between $P{empresaInicial} and $P{empresaFinal} and
otrs.ticket_type.name = 'Contrato PCH'
group by
EMPRESA
order by
EMPRESA]]>
</queryString>
<field name="EMPRESA" class="java.lang.String"/>
<field name="mes" class="java.lang.String"/>
<variable name="valorTotalRelatorio" class="java.lang.Double" resetType="Group" resetGroup="Empresa" calculation="System"/>
<variable name="valorHoraTrimestralRelatorio" class="java.lang.Double" resetType="Group" resetGroup="Empresa" calculation="System"/>
<variable name="multiplicadorServidorRelatorio" class="java.lang.Double" resetType="Group" resetGroup="Empresa" calculation="System"/>
<variable name="valorHoraAdicionalRelatorio" class="java.lang.Double" resetType="Group" resetGroup="Empresa" calculation="System"/>
<variable name="horasContratadasRelatorio" class="java.lang.Integer" resetType="Group" resetGroup="Empresa" calculation="System"/>
<variable name="quantidadeChamados" class="java.lang.Integer" resetType="None" incrementType="Group" incrementGroup="Empresa" calculation="Count"/>
<variable name="valorMensalRelatorio" class="java.lang.Double" resetType="Group" resetGroup="Empresa" calculation="System"/>
<variable name="arrayChamadosRelatorio" class="java.lang.String" resetType="Group" resetGroup="Empresa" calculation="System"/>
<variable name="valorTotalRequisicoesRelatorio" class="java.lang.Double" calculation="System"/>
<group name="Empresa">
<groupExpression><![CDATA[$F{EMPRESA}]]></groupExpression>
<groupHeader>
<band height="181">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<rectangle>
<reportElement x="0" y="71" width="802" height="20" forecolor="#4A8FC7" backcolor="#4A8FC7" uuid="7dff156d-4f09-428e-be15-6c4df13d2f9f">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</rectangle>
<subreport>
<reportElement x="10" y="95" width="670" height="76" uuid="75b469b7-ec70-423b-bf4e-f0b5e06284c1">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<subreportParameter name="empresaInicial">
<subreportParameterExpression><![CDATA[$F{EMPRESA}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="dataFinal">
<subreportParameterExpression><![CDATA[$P{dataFinal}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[java.sql.DriverManager.getConnection("jdbc:postgresql://192.168.1.226:5432/BancoDados","postgres","9ORwi%Iz4Uq9")]]></connectionExpression>
<returnValue subreportVariable="valorHoraTrimestralSubRelatorio" toVariable="valorHoraTrimestralRelatorio"/>
<returnValue subreportVariable="multiplicadorServidorSubRelatorio" toVariable="multiplicadorServidorRelatorio"/>
<returnValue subreportVariable="valorHoraAdicionalSubRelatorio" toVariable="valorHoraAdicionalRelatorio"/>
<returnValue subreportVariable="horasContratadasSubRelatorio" toVariable="horasContratadasRelatorio"/>
<returnValue subreportVariable="valorMensalSubRelatorio" toVariable="valorMensalRelatorio"/>
<subreportExpression><![CDATA[$P{cabecalho}]]></subreportExpression>
</subreport>
<textField>
<reportElement x="58" y="71" width="398" height="20" forecolor="#FFFFFF" backcolor="#FFFFFF" uuid="30790453-d6db-499c-9e64-b5c7de8e837f"/>
<textElement textAlignment="Left" verticalAlignment="Middle">
<font isBold="true" pdfFontName="Helvetica" pdfEncoding=""/>
</textElement>
<textFieldExpression><![CDATA[$F{EMPRESA}]]></textFieldExpression>
</textField>
<staticText>
<reportElement x="1" y="71" width="55" height="20" forecolor="#FFFFFF" backcolor="#FFFFFF" uuid="f32bbd89-a209-4f81-ab82-0b7c51042316">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<textElement textAlignment="Right" verticalAlignment="Middle">
<font isBold="true" pdfFontName="Helvetica"/>
</textElement>
<text><![CDATA[ CLIENTE:]]></text>
</staticText>
<image>
<reportElement x="10" y="13" width="121" height="37" uuid="44f92e3c-9af6-4264-bdd3-cfa1edc638f0"/>
<imageExpression><![CDATA["http://www.hss.com.br/images/logo_oficial.png"]]></imageExpression>
</image>
<staticText>
<reportElement x="172" y="11" width="498" height="21" uuid="1ce8eb7c-edca-40b6-bdf8-dcf0022444bf"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="16" isBold="true" pdfFontName="Helvetica"/>
</textElement>
<text><![CDATA[RELATÓRIO DE GERENCIAMENTO DE CHAMADOS]]></text>
</staticText>
<textField>
<reportElement x="351" y="32" width="100" height="20" uuid="593ccefe-36e5-49cd-8fe4-80ac098c4bd6"/>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font size="14"/>
</textElement>
<textFieldExpression><![CDATA[$F{mes}.replace("January", "Janeiro").replace("February", "Fevereiro").replace("March", "Março").replace("April", "Abril").replace("May", "Maio").replace("June", "Junho").replace("July", "Julho").replace("August", "Agosto").replace("September", "Setembro").replace("October", "Outubro").replace("November", "Novembro").replace("December", "Dezembro")]]></textFieldExpression>
</textField>
</band>
</groupHeader>
<groupFooter>
<band height="1">
<break>
<reportElement x="0" y="0" width="99" height="1" uuid="90838081-d37e-45bd-b976-39e6c76a3dc0"/>
</break>
</band>
</groupFooter>
</group>
<background>
<band splitType="Stretch"/>
</background>
<detail>
<band height="80">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<rectangle>
<reportElement x="7" y="10" width="384" height="15" forecolor="#4A8FC7" backcolor="#4A8FC7" uuid="77a5a131-5aa3-4094-9fa9-04f2fd2f1cd6">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
</rectangle>
<rectangle>
<reportElement x="412" y="10" width="384" height="15" forecolor="#4A8FC7" backcolor="#4A8FC7" uuid="5b5c11ca-5d00-47ab-b278-3bd60489290f"/>
</rectangle>
<staticText>
<reportElement x="412" y="30" width="55" height="15" uuid="714e6f4c-a47d-4916-96cb-217c63fe9fe6">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box>
<topPen lineWidth="0.6"/>
<leftPen lineWidth="0.6"/>
<bottomPen lineWidth="0.1"/>
<rightPen lineWidth="0.1"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" pdfFontName="Helvetica"/>
</textElement>
<text><![CDATA[Mês]]></text>
</staticText>
<staticText>
<reportElement x="412" y="45" width="55" height="15" uuid="dbe27dfa-8a79-4f1b-abc2-1af7f31f8cd7">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box>
<topPen lineWidth="0.1"/>
<leftPen lineWidth="0.6"/>
<bottomPen lineWidth="0.6"/>
<rightPen lineWidth="0.1"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Horas]]></text>
</staticText>
<subreport>
<reportElement x="467" y="30" width="252" height="30" uuid="fbf525b1-4034-4953-b828-86c2f7c634b1">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<subreportParameter name="empresa">
<subreportParameterExpression><![CDATA[$F{EMPRESA}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="dataInicial">
<subreportParameterExpression><![CDATA[$P{dataInicial}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="dataFinal">
<subreportParameterExpression><![CDATA[$P{dataFinal}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="parametro">
<subreportParameterExpression><![CDATA[$V{multiplicadorServidorRelatorio}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<subreportExpression><![CDATA[$P{conteudoPrincipal}]]></subreportExpression>
</subreport>
<staticText>
<reportElement x="719" y="30" width="77" height="15" uuid="4bd30050-0093-4014-b5f5-37a6f1a76b63">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box>
<topPen lineWidth="0.6"/>
<leftPen lineWidth="0.1"/>
<bottomPen lineWidth="0.1"/>
<rightPen lineWidth="0.6"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle">
<font isBold="true" pdfFontName="Helvetica"/>
</textElement>
<text><![CDATA[Tempo total]]></text>
</staticText>
<subreport>
<reportElement x="719" y="45" width="77" height="15" uuid="366ce86a-3346-488f-ab79-a01b1e2ec669">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<subreportParameter name="empresa">
<subreportParameterExpression><![CDATA[$F{EMPRESA}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="dataInicial">
<subreportParameterExpression><![CDATA[$P{dataInicial}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="dataFinal">
<subreportParameterExpression><![CDATA[$P{dataFinal}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="parametro">
<subreportParameterExpression><![CDATA[$V{multiplicadorServidorRelatorio}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<returnValue subreportVariable="valorTotalSubRelatorio" toVariable="valorTotalRelatorio"/>
<subreportExpression><![CDATA[$P{tempoTotal}]]></subreportExpression>
</subreport>
<staticText>
<reportElement x="554" y="10" width="100" height="15" forecolor="#FFFFFF" backcolor="#FFFFFF" uuid="b6d363b6-05d8-450f-9c97-1ea965339239">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Top">
<font size="11" isBold="true" isItalic="false"/>
</textElement>
<text><![CDATA[Trimestre]]></text>
</staticText>
<textField pattern="">
<reportElement x="148" y="10" width="100" height="15" forecolor="#FFFFFF" backcolor="#FFFFFF" uuid="229eebaa-f51b-4186-938a-06c341e19f40">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<textElement textAlignment="Center" verticalAlignment="Top">
<font size="11" isBold="true"/>
</textElement>
<textFieldExpression><![CDATA[$F{mes}.replace("January", "Janeiro").replace("February", "Fevereiro").replace("March", "Março").replace("April", "Abril").replace("May", "Maio").replace("June", "Junho").replace("July", "Julho").replace("August", "Agosto").replace("September", "Setembro").replace("October", "Outubro").replace("November", "Novembro").replace("December", "Dezembro")]]></textFieldExpression>
</textField>
<subreport>
<reportElement x="7" y="30" width="384" height="45" uuid="7312ba1a-c833-454e-a5ed-0ac8b86a2695">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<subreportParameter name="empresa">
<subreportParameterExpression><![CDATA[$F{EMPRESA}]]></subreportParameterExpression>
</subreportParameter>
<subreportParameter name="parametro">
<subreportParameterExpression><![CDATA[$V{multiplicadorServidorRelatorio}]]></subreportParameterExpression>
</subreportParameter>
<connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
<returnValue subreportVariable="arrayChamadosSubRelatorio" toVariable="arrayChamadosRelatorio"/>
<subreportExpression><![CDATA[$P{resumoMensal}]]></subreportExpression>
</subreport>
<line>
<reportElement stretchType="RelativeToTallestObject" x="406" y="0" width="1" height="80" uuid="972f5ac6-a5e9-43a1-aa2f-50d10c2c1bfe">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<graphicElement>
<pen lineStyle="Dashed" lineColor="#D9D9D9"/>
</graphicElement>
</line>
<line>
<reportElement stretchType="RelativeToTallestObject" x="802" y="0" width="1" height="80" uuid="9c1090f2-20de-481a-8207-6a12b06552b3">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<graphicElement>
<pen lineStyle="Dashed" lineColor="#D9D9D9"/>
</graphicElement>
</line>
<line>
<reportElement x="406" y="0" width="397" height="1" uuid="8b17c238-66c5-4b94-8da0-0a4427b622ff">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<graphicElement>
<pen lineStyle="Dashed" lineColor="#D9D9D9"/>
</graphicElement>
</line>
<line>
<reportElement x="0" y="0" width="397" height="1" uuid="4292612f-4f93-4931-bc0f-ba79878be37c">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<graphicElement>
<pen lineStyle="Dashed" lineColor="#D9D9D9"/>
</graphicElement>
</line>
<line>
<reportElement stretchType="RelativeToTallestObject" x="397" y="0" width="1" height="80" uuid="096d778a-0de1-4415-b1ea-89ca9fba7688">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<graphicElement>
<pen lineStyle="Dashed" lineColor="#D9D9D9"/>
</graphicElement>
</line>
<line>
<reportElement stretchType="RelativeToTallestObject" x="0" y="0" width="1" height="80" uuid="0f150b56-4ef1-44d7-8776-5981c7d48c9d">
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<graphicElement>
<pen lineStyle="Dashed" lineColor="#D9D9D9"/>
</graphicElement>
</line>
</band>
<band height="272">
<staticText>
<reportElement x="496" y="45" width="103" height="15" uuid="9180e0f1-23b1-410e-8a94-0767ef08b84d">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
</reportElement>
<box>
<topPen lineWidth="0.1"/>
<leftPen lineWidth="0.6"/>
<bottomPen lineWidth="0.1"/>
<rightPen lineWidth="0.1"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<text><![CDATA[Valor hora adicional]]></text>
</staticText>
<textField>
<reportElement x="599" y="45" width="103" height="15" uuid="f5c1b9fa-4807-4954-b63b-44cb455f9782">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>
</reportElement>
<box>
<topPen lineWidth="0.1"/>
<leftPen lineWidth="0.1"/>
<bottomPen lineWidth="0.1"/>
<rightPen lineWidth="0.6"/>
</box>
<textElement textAlignment="Center" verticalAlignment="Middle"/>
<textFieldExpression><![CDATA[java.text.NumberFormat.getCurrencyInstance(new Locale("pt","br")).format($V{valorHoraAdicionalRelatorio})]]></textFieldExpression>
</textField>
<textField pattern="#0.00">
<reportElement x="599" y="30" width="103" height="15" uuid="90d29675-0270-401a-8c81-7aa72ffc958f">
<property name="local_mesure_unitheight" value="pixel"/>
<property name="com.jaspersoft.studio.unit.height" value="px"/>
<property name="local_mesure_unitwidth" value="pixel"/>
<property name="com.jaspersoft.studio.unit.width" value="px"/>