Como descubro esta fonte ?
Mesmo erro …
at java.desktop/sun.awt.FontConfiguration.getVersion(Unknown Source) ~[na:na]
Como descubro esta fonte ?
Mesmo erro …
at java.desktop/sun.awt.FontConfiguration.getVersion(Unknown Source) ~[na:na]
Uai, usa uma fonte padrão!
No seu printscreen a pasta se chama relatorio
, no singular.
No arquivo .properties você pôs relatorios
, no plural.
Põe uma barra ( /
) na frente do "relatorio/fonts/fonts.xml"
para garantir que ele pesquise a partir da raíz do classpath
.
Já fiz está alteração.
Local dá este erro
Caused by: net.sf.jasperreports.engine.JRException: Input stream not found at: /relatorio/fonts/fonts.xml. at net.sf.jasperreports.repo.RepositoryUtil.getInputStreamFromLocation(RepositoryUtil.java:175) ~[jasperreports-6.16.0.jar:6.16.0-48579d909b7943b64690c65c71e07e0b80981928] at net.sf.jasperreports.engine.fonts.SimpleFontExtensionHelper.loadFontExtensions(SimpleFontExtensionHelper.java:186) ~[jasperreports-6.16.0.jar:6.16.0-48579d909b7943b64690c65c71e07e0b80981928] ... 106 common frames omitted
Estou usando todos Arial.
Nada funciona.
Essas fontes estão instaladas no seu ambiente de homologação?
Não. Se possível, me diz, como instalar. Linux ubuntu
Mas daí tu me quebra.
Como é que sua aplicação vai usar uma fonte que você não tem?
Acredito que se você instalar o fontconfig
vá funcionar:
apt-get install --assume-yes fontconfig
Na verdade eu nem sabia que tinha que instalar as fontes. Por isso coloquei os logs. Porque no windows, já vem né
Vou instalar e testar e falo aqui.
Fiz e não funcionou.
reiniciei o servidor
Mesmo erro
2021-01-15 14:43:49.856 ERROR 1 --- [nio-8600-exec-2] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/modulo-relatorio-api] threw exception [Handler dispatch failed; nested exception is java.lang.InternalError: java.lang.reflect.InvocationTargetException] with root cause java.lang.NullPointerException: null at java.desktop/sun.awt.FontConfiguration.getVersion(Unknown Source) ~[na:na]
2021-01-15 15:11:07.845 ERROR 1 — [nio-8600-exec-4] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/modulo-relatorio-api] threw exception [Handler dispatch failed; nested exception is java.lang.InternalError: java.lang.reflect.InvocationTargetException] with root cause
Mesmo erro
java.lang.NullPointerException: null at java.desktop/sun.awt.FontConfiguration.getVersion(Unknown Source) ~[na:na]
Reiniciei o servidor e o mesmo erro
Importe o “jasperreports-fonts” no seu pom.xml, e use a font dejavu em seu relatório.
Mesmo erro
<dependency> <groupId>net.sf.jasperreports</groupId> <artifactId>jasperreports-fonts</artifactId> <version>6.16.0</version> </dependency>
2021-01-18 09:37:19.377 ERROR 1 --- [nio-8600-exec-2] o.a.c.c.C.[.[.[.[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/modulo-relatorio-api] threw exception [Handler dispatch failed; nested exception is java.lang.InternalError: java.lang.reflect.InvocationTargetException] with root cause java.lang.NullPointerException: null at java.desktop/sun.awt.FontConfiguration.getVersion(Unknown Source) ~[na:na]
Código do relatório
<?xml version="1.0" encoding="UTF-8"?> <!-- Created with Jaspersoft Studio version 6.16.0.final using JasperReports Library version 6.16.0-48579d909b7943b64690c65c71e07e0b80981928 --> <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="requisicao_compra" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="dc2fbcb2-ebfb-40d9-b501-eec6cdc69a10"> <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/> <parameter name="nomeRede" class="java.lang.String"/> <parameter name="lojaOrigem" class="java.lang.String"/> <parameter name="lojaDestino" class="java.lang.String"/> <parameter name="funcionario" class="java.lang.String"/> <parameter name="dataEntrega" class="java.lang.String"/> <parameter name="natureza" class="java.lang.String"/> <parameter name="numeroRequisicao" class="java.lang.Long"/> <parameter name="status" class="java.lang.String"/> <parameter name="total" class="java.math.BigDecimal"/> <queryString> <![CDATA[]]> </queryString> <field name="insumo" class="java.lang.String"/> <field name="unidade" class="java.lang.String"/> <field name="quantidade" class="java.math.BigDecimal"/> <field name="quantidadeAprovada" class="java.math.BigDecimal"/> <field name="ultimoCusto" class="java.math.BigDecimal"/> <field name="total" class="java.math.BigDecimal"/> <title> <band height="79" splitType="Stretch"> <frame> <reportElement x="0" y="0" width="555" height="79" uuid="0468d480-1644-481f-9969-a2681bd67cf1"> <property name="com.jaspersoft.studio.unit.height" value="px"/> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textField isBlankWhenNull="true"> <reportElement x="145" y="55" width="404" height="20" uuid="04ba1364-25ef-4213-8a6f-5783067a77c5"/> <textElement textAlignment="Justified" verticalAlignment="Middle"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$P{nomeRede}]]></textFieldExpression> </textField> <textField> <reportElement x="305" y="15" width="126" height="20" uuid="531ce186-9007-4662-9d03-0afb938ba448"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$P{numeroRequisicao}]]></textFieldExpression> </textField> <staticText> <reportElement x="145" y="35" width="40" height="20" uuid="c20573e3-faac-4d7c-877c-b625df378698"/> <textElement verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Status:]]></text> </staticText> <textField> <reportElement x="185" y="35" width="270" height="19" uuid="4620e90f-8559-4872-9e39-e2822b1d8766"/> <textElement verticalAlignment="Middle"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$P{status}]]></textFieldExpression> </textField> <staticText> <reportElement x="145" y="15" width="170" height="20" uuid="0c526bcc-d9fc-4ce6-bb5a-30cc51a7beb8"/> <textElement verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Requisição de compras - Número:]]></text> </staticText> </frame> </band> </title> <pageHeader> <band height="100" splitType="Stretch"> <frame> <reportElement x="0" y="0" width="555" height="100" uuid="e3573e27-a0bd-48ef-9c1f-4bff615fc7ed"> <property name="com.jaspersoft.studio.unit.width" value="px"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> </reportElement> <box> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <staticText> <reportElement x="3" y="5" width="100" height="20" uuid="b4fd2c15-1212-42d2-9a8d-08452ec7b39c"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Loja de origem:]]></text> </staticText> <staticText> <reportElement x="3" y="23" width="100" height="20" uuid="683f02ab-089a-4caa-b97f-f01efa2e9715"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Loja de destino:]]></text> </staticText> <staticText> <reportElement x="3" y="41" width="114" height="20" uuid="92b7359f-c8db-4d3f-9dfa-96284e6ece4f"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Funcionário solicitante:]]></text> </staticText> <staticText> <reportElement x="3" y="57" width="114" height="20" uuid="2674a5c4-8de9-4f04-a5f6-3000a67ee464"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Data de entrega:]]></text> </staticText> <staticText> <reportElement x="3" y="74" width="114" height="20" uuid="52cc4dde-d762-4b5e-a592-14f17e67ce08"/> <textElement textAlignment="Left" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Natureza:]]></text> </staticText> <textField> <reportElement x="123" y="5" width="428" height="20" uuid="e4bcefb5-4e13-402e-8ce7-8a5898468640"> <property name="com.jaspersoft.studio.unit.height" value="px"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <textElement verticalAlignment="Middle"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$P{lojaOrigem}]]></textFieldExpression> </textField> <textField> <reportElement x="123" y="23" width="428" height="20" uuid="400a4267-11a5-4e22-866a-7880221af6ca"> <property name="com.jaspersoft.studio.unit.height" value="px"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <textElement verticalAlignment="Middle"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$P{lojaDestino}]]></textFieldExpression> </textField> <textField> <reportElement x="123" y="41" width="428" height="20" uuid="7ce621fc-a2af-4173-aa31-875f4920851e"> <property name="com.jaspersoft.studio.unit.height" value="pixel"/> <property name="com.jaspersoft.studio.unit.x" value="pixel"/> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <textElement verticalAlignment="Middle"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$P{funcionario}]]></textFieldExpression> </textField> <textField> <reportElement x="123" y="57" width="428" height="20" uuid="a18eab4e-ca44-4c30-b2c1-071209d31810"> <property name="com.jaspersoft.studio.unit.height" value="px"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <textElement verticalAlignment="Middle"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$P{dataEntrega}]]></textFieldExpression> </textField> <textField> <reportElement x="123" y="74" width="428" height="20" uuid="f40c9c1a-aca9-4f24-bd5a-3ae48ed463f5"> <property name="com.jaspersoft.studio.unit.height" value="px"/> <property name="com.jaspersoft.studio.unit.x" value="px"/> </reportElement> <textElement verticalAlignment="Middle"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$P{natureza}]]></textFieldExpression> </textField> </frame> </band> </pageHeader> <columnHeader> <band height="20" splitType="Stretch"> <rectangle> <reportElement x="0" y="0" width="555" height="20" uuid="b344f051-c362-45d9-a7d6-fe30bd104636"> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> </rectangle> <staticText> <reportElement x="0" y="0" width="115" height="20" uuid="cde891fa-bae7-41a5-94a0-47b804420ddb"> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Insumo]]></text> </staticText> <staticText> <reportElement x="115" y="0" width="115" height="20" uuid="09992034-eeb2-4316-b7a3-7e19648c1d01"> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Unidade]]></text> </staticText> <staticText> <reportElement x="230" y="0" width="70" height="20" uuid="9cb4ef90-ac40-4f65-b45d-07497b344784"/> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Quantidade]]></text> </staticText> <staticText> <reportElement x="300" y="0" width="114" height="20" uuid="8fd615c0-1d4f-47f7-bf9e-86069acefcf3"/> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Quantidade aprovada]]></text> </staticText> <staticText> <reportElement x="414" y="0" width="70" height="20" uuid="fec69755-7b9c-4170-bcb2-3a4357139ad6"/> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Último custo]]></text> </staticText> <staticText> <reportElement x="484" y="0" width="71" height="20" uuid="af503b49-015f-4009-87dc-f878b61aed39"> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="DejaVu Sans" isBold="true"/> </textElement> <text><![CDATA[Total]]></text> </staticText> </band> </columnHeader> <detail> <band height="15" splitType="Stretch"> <rectangle> <reportElement x="0" y="0" width="555" height="15" uuid="81a82bf0-a03a-439e-b66d-b80189b75da2"> <property name="com.jaspersoft.studio.unit.width" value="px"/> </reportElement> </rectangle> <textField isBlankWhenNull="true"> <reportElement x="0" y="0" width="115" height="15" uuid="cb6566e7-748e-47ef-9062-df8983589f1a"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="3e4e53c1-8e10-4f35-9c07-96663252d66e"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$F{insumo}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="115" y="0" width="115" height="15" uuid="f817358a-9843-4700-b048-54aec74fc1ed"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="bc44918f-fbd3-4ac2-837d-ff111d837a9b"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$F{unidade}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="230" y="0" width="70" height="15" uuid="1062209a-39d5-4c6c-ae3e-5d5c480e6477"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="fc955d55-a729-412f-b5b0-748da3aff69b"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement textAlignment="Right"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$F{quantidade}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="300" y="0" width="114" height="15" uuid="4cc0fb38-84c1-41e4-860e-88d01d2db97a"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="d3ab1af9-8dd4-4018-a8a3-26ef94c3fb6a"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement textAlignment="Right"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$F{quantidadeAprovada}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="414" y="0" width="70" height="15" uuid="59624797-edde-46d3-8bee-d15ed404655b"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="f3b50293-6e9e-438f-82b2-23fcef6429d5"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement textAlignment="Right"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$F{ultimoCusto}]]></textFieldExpression> </textField> <textField isBlankWhenNull="true"> <reportElement x="484" y="0" width="71" height="15" uuid="eb49fbf4-9a06-4512-b8c1-41a2651348bf"> <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="7480404f-5f56-46f1-838b-ad82ddbc70fe"/> <property name="com.jaspersoft.studio.unit.height" value="px"/> </reportElement> <box padding="0"> <pen lineWidth="1.0" lineStyle="Solid"/> </box> <textElement textAlignment="Right"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$F{total}]]></textFieldExpression> </textField> </band> </detail> <columnFooter> <band height="17" splitType="Stretch"> <staticText> <reportElement x="0" y="3" width="100" height="14" uuid="ba880021-c511-4016-ae7c-e64a9af55b2f"/> <textElement> <font fontName="DejaVu Sans" size="9"/> </textElement> <text><![CDATA[Food & Franquias]]></text> </staticText> <textField pattern="dd/MM/yyy"> <reportElement x="240" y="3" width="100" height="14" uuid="6c82a50e-51c9-4fe5-a293-a8a8e871c847"/> <textElement textAlignment="Center"> <font fontName="DejaVu Sans" size="9"/> </textElement> <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> </textField> <textField pattern="HH:mm"> <reportElement x="300" y="3" width="100" height="14" uuid="9d4e440a-a9c0-45fe-bc56-1cbac8173c59"/> <textElement textAlignment="Center"> <font fontName="DejaVu Sans" size="9"/> </textElement> <textFieldExpression><![CDATA[new java.util.Date()]]></textFieldExpression> </textField> <textField> <reportElement x="400" y="3" width="154" height="14" uuid="7a39f766-62b4-4727-9aac-9810ab0f2cd3"/> <textElement textAlignment="Right"> <font fontName="DejaVu Sans" size="9"/> </textElement> <textFieldExpression><![CDATA["Página " + $V{PAGE_NUMBER} + " de " + $V{PAGE_NUMBER}]]></textFieldExpression> </textField> <line> <reportElement x="0" y="0" width="555" height="1" uuid="88c8ba78-9506-429e-8f5a-2ddbe7170cdc"> <property name="com.jaspersoft.studio.unit.height" value="px"/> </reportElement> </line> </band> </columnFooter> <summary> <band height="20" splitType="Stretch"> <staticText> <reportElement x="449" y="0" width="35" height="20" uuid="35af2d97-fd05-4cc5-b09a-9e06216588a5"/> <textElement textAlignment="Right" verticalAlignment="Middle"> <font isBold="true"/> </textElement> <text><![CDATA[Total:]]></text> </staticText> <textField> <reportElement x="454" y="0" width="100" height="20" uuid="bcd63138-bf77-446e-9728-c2de0169e4e4"/> <textElement textAlignment="Right" verticalAlignment="Middle"> <font fontName="DejaVu Sans"/> </textElement> <textFieldExpression><![CDATA[$P{total}]]></textFieldExpression> </textField> </band> </summary> <noData> <band height="50"> <staticText> <reportElement x="0" y="0" width="553" height="50" uuid="5feb469b-e64a-4bf9-aed4-9bc2ca007c21"/> <textElement textAlignment="Center" verticalAlignment="Middle"> <font fontName="DejaVu Sans" size="14" isBold="true"/> </textElement> <text><![CDATA[Sem registros !!!]]></text> </staticText> </band> </noData> </jasperReport>
Você está configurando as fontes como dependência do seu projeto maven, mas o problema não é o projeto, se fosse, não funcionaria localmente.
O problema é que essas fontes não estão instaladas no seu servidor de homologação.
Talvez você tenha que falar com o pessoal de infraestrutura.
Galera estou com problemas no Jasper, alguem poderia me ajudar?
Prezado, você tem que descrever o problema.
Estou com uma app Web, feita com frame Vaadin + MySQL + Spring, fiz o relatório usando JasperStudio, passei a query dentro do próprio relatório e ele está me retornando corretamente os dados do banco. O arquivo jrxml gerado pelo Studio foi salvo dentro do projeto, estou usando a IDE Eclipse, salvei o jrxml em src/main/resources/Relatorio/RelatorioVendas.jrxml. Agora quero pegar este arquivo jrxml e exporta-lo para PDF, não quero exibir ele em navegador, não quero fazer download dele…a unica coisa que quero é criar um pdf na mesma pasta onde está jrxml. Ja li inumeros sites com exemplos de códigos, mas tudo que tentei não deu certo, então preciso de uma orientação(passo a passo) para fazer as conversões necessarias para obter tal resultado.