Versão atual:

[Resolvido]Erro ao gerar jasperReports com subRebport

Bom dia galera estou com um problema para gerar um ireport que chama um subreport, minha aplicação é em java desktop ao gerar pela minha maquina onde foi criado o subreport ele gera normalmente fiz um teste para tentar gerar em outra maquina dele retorna um erro dizendo que não encontrou o subreport no diretorio que eu salvei na minha maquina. Alguem poderia me dar um exemplo de como chamar o ireport de maneira correta, estou acionando o evento por um jbutton abaixo segue o código.


 Conexao_BD conexao = new Conexao_BD();

    int parametro = 0;

    String numeroCliente;

   numeroCliente = jTextFieldOrcamento.getText();

   if ((numeroCliente == null) || (numeroCliente.trim().isEmpty())) {


 JOptionPane.showMessageDialog(this, "O Código deve ser Preenchido! VERIFIQUE!", "Código VAZIO!",       JOptionPane.ERROR_MESSAGE);

    } 

else {
      try {
//          
             parametro = Integer.parseInt(numeroCliente);
              HashMap param = new HashMap();


                param.put("idCliente", parametro); 

                System.out.println("parametro para gerar o relatorio " + param);

                JasperPrint relatorio = null;
                System.out.println("Entra para gerar os relatorios");

                String dir = System.getProperty("user.dir");;

                relatorio = JasperFillManager.fillReport(dir + "/Relatorios/relatorios/OrcamentoVendasCliente.jasper", param, conexao.con);

                JasperViewer.viewReport(relatorio, false);

            }

 catch (Exception e) {

 JOptionPane.showMessageDialog(this, "Erro: AO GERAR ORÇAMENTO... VERIFIQUE!!! " + e.getMessage(), "ERRO!", JOptionPane.ERROR_MESSAGE);

                System.out.println("ERRO AO GERAR JASPERREPORTS ");

            } 

               finally {
                conexao.fecharConexao();
                jTextFieldOrcamento.setText(null);
            }


        }

Nesse código estou chamando apenas o report principal e ele chama o subReport , mas em outra maquina ele não quer gerar corretamente. Desde já muito obrigado.

Abaixo o código do XML

<?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="orcamentoVendasCliente" pageWidth="792" pageHeight="612" 
              orientation="Landscape" columnWidth="752" leftMargin="20" rightMargin="20"   
              topMargin="20" bottomMargin="20" uuid="8b1ae9f1-04ae-4444-92da-c7a80ad6df53"><property name="ireport.zoom" value="1.5"/>
<property name="ireport.x" value="0"/>
<property name="ireport.y" value="0"/>
<parameter name="idCliente" class="java.lang.Integer">
defaultValueExpression><![CDATA[]]></defaultValueExpression> </parameter>

<parameter name="SUBREPORT_DIR" class="java.lang.String" isForPrompting="false">
<defaultValueExpression><![CDATA["C:\\Documents and Settings\\Marcosvieira\\Desktop\\Projeto LUC\\prd\\Luc 1.1\\Relatorios\\relatorios\\"]]></defaultValueExpression></parameter>

<queryString>
        <![CDATA[SELECT

     TO_char(VENH.DATA_EMISSAO,'dd/mm/yyyy')    AS  DT_EMISSAO,
    VENH.ID_VENDAS       AS NUMERO_VENDA,
    CLI.NOME_CLIENTE     AS NOME_CLIENTE,
    VENH.FORMA_PAGAMENTO AS FORMA_PAG,
    VENH.TOTAL_VENDA     AS VLR_TOTAL_ITENS,
    CASE
      WHEN VENH.TOTAL_VENDA_GERAL IS NULL THEN
       '0.00'
      ELSE
       VENH.TOTAL_VENDA_GERAL
    END AS TOTAL,
    VENH.DESCONTO AS DESCONTO,
    VE.APELIDO_VENDEDOR           AS NOME_VENDEDOR,
    CASE
      WHEN VENH.VALOR_TROCA IS NULL THEN
       '0.00'
      ELSE
       VENH.VALOR_TROCA
    END AS VALOR_TROCA


     FROM VENDAS_HEADER VENH,
          VENDAS_LINES  VENL,
          CLIENTE       CLI,

          VENDEDOR      VE
    WHERE VENH.ID_VENDAS = VENL.ID_VENDAS
      AND VENH.ID_CLIENTE = CLI.ID_CLIENTE

      AND VENH.ID_VENDEDOR = VE.ID_VENDEDOR
      AND VENH.STATUS_VENDA = 'P'
      and cli.id_cliente = $P{idCliente}

group by
   VENH.DATA_EMISSAO ,
    VENH.ID_VENDAS     ,
    CLI.NOME_CLIENTE     ,
    VENH.FORMA_PAGAMENTO ,
    VENH.TOTAL_VENDA   ,
    VE.APELIDO_VENDEDOR ,
    VENH.VALOR_TROCA

Order by
venh.id_Vendas]]>
    </queryString>
    <field name="dt_emissao" class="java.lang.String"/>
    <field name="numero_venda" class="java.lang.Integer"/>
    <field name="nome_cliente" class="java.lang.String"/>
    <field name="forma_pag" class="java.lang.String"/>
    <field name="vlr_total_itens" class="java.lang.String"/>
    <field name="total" class="java.lang.String"/>
    <field name="desconto" class="java.lang.String"/>
    <field name="nome_vendedor" class="java.lang.String"/>
    <field name="valor_troca" class="java.lang.String"/>
    <group name="grupo1" isStartNewPage="true">
        <groupExpression><![CDATA[$F{numero_venda}]]></groupExpression>
        <groupHeader>
            <band height="23">
                <textField>
<reportElement uuid="1d72975c-fb6e-4ae3-bd98-0ecce3594eae" x="1" y="0" width="40" height="19"/>
                    <textElement/>
<textFieldExpression><![CDATA["Venda:"]]></textFieldExpression>
                </textField>
<textField><reportElement uuid="f16afa5f-2084-41a7-a930-fca879c42e08" x="40" y="0" width="100" height="19"/>
<textElement/>
<textFieldExpression><![CDATA[$F{numero_venda}]]></textFieldExpression>
                </textField>
                <textField>
<reportElement uuid="d3c8f5c2-5aa8-4fc6-85e1-1dbe816408e8" x="230" y="1" width="100" height="19"/>
                    <textElement/>
<textFieldExpression><![CDATA[$F{nome_vendedor}]]></textFieldExpression>
                </textField>
<textField> <reportElement uuid="91552d54-911d-4659-947c-931d93d2ce9a" x="175" y="1" width="55" height="19"/>
                    <textElement/>
                    <textFieldExpression><![CDATA["Vendedor:"]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement uuid="b8e436e9-1dfc-45ad-985f-01d157e63c3a" x="427" y="1" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression><![CDATA[$F{forma_pag}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement uuid="25e926b8-03a3-46b3-a319-40b19070f1bf" x="360" y="1" width="67" height="20"/>
                    <textElement/>
                    <textFieldExpression><![CDATA["Pagamento:"]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement uuid="3fecbf79-9f63-4d73-a876-439ac332b5bb" x="651" y="1" width="100" height="20"/>
                    <textElement/>
                    <textFieldExpression><![CDATA[$F{dt_emissao}]]></textFieldExpression>
                </textField>
                <textField>
                    <reportElement uuid="d5065cfc-f8e3-4762-9efe-8f258adc97e4" x="573" y="1" width="78" height="20"/>
                    <textElement/>
                    <textFieldExpression><![CDATA["Data Venda:"]]></textFieldExpression>
                </textField>
            </band>
        </groupHeader>
    </group>
    <title>
        <band height="79" splitType="Stretch">
            <textField>
                <reportElement uuid="ca79efd4-7257-4831-b337-61a1925ffb18" x="0" y="0" width="201" height="18"/>
                <textElement textAlignment="Center">
                    <font size="12" isBold="true"/>
                </textElement>
                <textFieldExpression><![CDATA["ROSI ATACADO DA LINGERI"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="86f89bfd-7150-42c5-9b81-7d5d85245eb1" x="1" y="53" width="151" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA["Juruaia - MG - CEP: 37805-000"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="14487576-8122-4b25-bf25-9a8f6af6e355" x="1" y="18" width="130" height="15"/>
                <textElement/>
                <textFieldExpression><![CDATA["CNPJ: 18.647.429/0001-30"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="7346d85d-391a-48a8-bc08-116215893652" x="130" y="18" width="142" height="15"/>
                <textElement/>
                <textFieldExpression><![CDATA["IEs:002200430.00-51"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="5371e6b1-1faf-4e54-ac52-52cb3d6e75df" x="1" y="33" width="271" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA["Endereço: Orlando de Castro, 21 Bairro: Mirante"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="deb46766-55c4-4eb3-9160-1b3794910a89" x="633" y="38" width="119" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA["Fone: (35)3553-1119"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="32b2c866-c420-4b46-8217-827feaa37ac7" x="633" y="58" width="119" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA["Cel: (35)9251-6869"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="6896ad95-6dc9-4f75-a4bc-1579035c859e" x="301" y="42" width="208" height="21"/>
                <textElement textAlignment="Center">
                    <font size="16" isBold="true" isUnderline="true"/>
                </textElement>
                <textFieldExpression><![CDATA["Orçamento por Cliente"]]></textFieldExpression>
            </textField>
        </band>
    </title>
    <pageHeader>
        <band height="21" splitType="Stretch">
            <textField>
                <reportElement uuid="6713ff49-bf17-4ee5-bb07-67fdaf8fe00c" x="252" y="1" width="275" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{nome_cliente}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="519f5536-0e9d-4bc1-bc39-43404b302e12" x="212" y="1" width="40" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA["Cliente:"]]></textFieldExpression>
            </textField>
            <line>
                <reportElement uuid="a0abda01-5cce-405c-a4d3-f94f3788e75d" x="0" y="20" width="751" height="1"/>
            </line>
            <line>
                <reportElement uuid="66183e1f-c381-4911-a42d-3e63490a53b2" x="1" y="0" width="751" height="1"/>
            </line>
        </band>
    </pageHeader>
    <detail>
        <band height="107" splitType="Stretch">
            <textField>
                <reportElement uuid="5af6b0be-8cb3-4846-81c2-f21c2d079eca" positionType="Float" x="655" y="94" width="97" height="13"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{total}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="d0a9fe79-b644-42be-b85b-c9e6ae10e6ec" positionType="Float" x="590" y="80" width="65" height="14"/>
                <textElement/>
                <textFieldExpression><![CDATA["Troca:"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="4570fb7a-55a6-40fe-a42b-6a1dc0fbeb00" positionType="Float" x="655" y="80" width="97" height="14"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{valor_troca}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="53a6e25c-e01c-4566-935a-9d6604a4ac6d" positionType="Float" x="590" y="50" width="65" height="18"/>
                <textElement/>
                <textFieldExpression><![CDATA["Totalizado:"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="bc7aa27a-5eee-4643-8bc2-be11f38b6b8c" positionType="Float" x="590" y="67" width="65" height="13"/>
                <textElement/>
                <textFieldExpression><![CDATA["Desconto:"]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="b0982d38-c3e6-424d-8942-7939c4904fbd" positionType="Float" x="655" y="50" width="97" height="18"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{vlr_total_itens}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="b430abd3-4528-4796-9683-ed01015aa641" positionType="Float" x="655" y="67" width="97" height="13"/>
                <textElement/>
                <textFieldExpression><![CDATA[$F{desconto}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="c1efa7c1-ed57-4252-aa91-d14b7a013029" positionType="Float" x="590" y="94" width="65" height="13"/>
                <textElement/>
                <textFieldExpression><![CDATA["Valor Total:"]]></textFieldExpression>
            </textField>
            <subreport>
                <reportElement uuid="7234c72e-64f9-4861-b492-0cd42918cd76" x="0" y="1" width="752" height="47"/>
                <subreportParameter name="idVenda">
                    <subreportParameterExpression><![CDATA[$F{numero_venda}]]></subreportParameterExpression>
                </subreportParameter>
                <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                <subreportExpression><![CDATA[$P{SUBREPORT_DIR} + "subRelatorioProdutosVendidos.jasper"]]></subreportExpression>
            </subreport>
            <line>
                <reportElement uuid="58fb9f27-e7ff-46b6-b104-74d9ae341690" x="0" y="0" width="751" height="1"/>
            </line>
        </band>
    </detail>
    <pageFooter>
        <band height="50">
            <textField pattern="EEEEE dd MMMMM yyyy">
                <reportElement uuid="b6f59bcd-853e-494e-98ba-1f6845682fd0" x="0" y="0" width="194" height="20"/>
                <textElement textAlignment="Center"/>
                <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement uuid="7d073c5a-3c5e-4f4e-9341-7ed404bb5d12" x="631" y="0" width="80" height="20"/>
                <textElement textAlignment="Right"/>
                <textFieldExpression><![CDATA["Página "+$V{PAGE_NUMBER}+" de"]]></textFieldExpression>
            </textField>
            <textField evaluationTime="Report">
                <reportElement uuid="dd3d2d3b-0eee-4089-8626-99f84a06d92d" x="710" y="0" width="41" height="20"/>
                <textElement/>
                <textFieldExpression><![CDATA[" " + $V{PAGE_NUMBER}]]></textFieldExpression>
            </textField>
        </band>
    </pageFooter>
</jasperReport>

Versões(6):

Ver a versão formatada

Erro ao gerar jasperReports com subRebport

Comentário

new question