Forum Stats

  • 3,815,605 Users
  • 2,259,059 Discussions
  • 7,893,185 Comments

Discussions

java.lang.ArrayIndexOutOfBoundsException: 0 at sun.font.CompositeStrike.getStrikeForSlot(CompositeSt

f056d4c0-cc23-4611-bb2a-41d304d6c3d0
edited Oct 30, 2017 8:42PM in Java Programming

Hello!

I have the next dependency and infrastructure:

jasperreports-3.1.2.jar

weblogic 12.1.3 with java 1.8.0_77 for server

OS: RHEL 7.2

Also I have ARIAL.TTF file on classpath /fonts/ARIAL.TTF

My compiled template is:

<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="reportMilitaryMrtgObjBaseTable" pageWidth="802" pageHeight="900" columnWidth="802" leftMargin="0" rightMargin="0" topMargin="0" bottomMargin="0">
     <background>
         <band/>
     </background>
     <title>
         <band/>
     </title>
     <pageHeader>
         <band/>
     </pageHeader>
     <detail>
         <band height="20">
             <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                 <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="0" y="0" width="160" height="20" isPrintWhenDetailOverflows="true" forecolor="#000000"/>
                 <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                     <topPen lineWidth="1.0"/>
                     <leftPen lineWidth="1.0"/>
                     <bottomPen lineWidth="1.0"/>
                 </box>
                 <textElement textAlignment="Center" verticalAlignment="Middle">
                     <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                 </textElement>
                 <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
             </textField>
             <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                 <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="482" y="0" width="160" height="20" isPrintWhenDetailOverflows="true" forecolor="#000000"/>
                 <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                     <topPen lineWidth="1.0"/>
                     <leftPen lineWidth="1.0"/>
                     <bottomPen lineWidth="1.0"/>
                 </box>
                 <textElement textAlignment="Center" verticalAlignment="Middle">
                     <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                 </textElement>
                 <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
             </textField>
             <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                 <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="642" y="0" width="160" height="20" isPrintWhenDetailOverflows="true"/>
                 <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                     <topPen lineWidth="1.0"/>
                     <leftPen lineWidth="1.0"/>
                     <bottomPen lineWidth="1.0"/>
                     <rightPen lineWidth="1.0"/>
                 </box>
                 <textElement textAlignment="Center" verticalAlignment="Middle" rotation="None">
                     <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                 </textElement>
                 <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
             </textField>
             <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                 <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="322" y="0" width="160" height="20" isPrintWhenDetailOverflows="true" forecolor="#000000"/>
                 <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                     <topPen lineWidth="1.0"/>
                     <leftPen lineWidth="1.0"/>
                     <bottomPen lineWidth="1.0"/>
                 </box>
                 <textElement textAlignment="Center" verticalAlignment="Middle">
                     <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                 </textElement>
                 <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
             </textField>
             <textField isStretchWithOverflow="true" isBlankWhenNull="true">
                 <reportElement positionType="Float" stretchType="RelativeToTallestObject" x="160" y="0" width="162" height="20" isPrintWhenDetailOverflows="true" forecolor="#000000"/>
                 <box topPadding="1" leftPadding="1" bottomPadding="1" rightPadding="1">
                     <topPen lineWidth="1.0"/>
                     <leftPen lineWidth="1.0"/>
                     <bottomPen lineWidth="1.0"/>
                 </box>
                 <textElement textAlignment="Center" verticalAlignment="Middle">
                     <font fontName="Arial" pdfFontName="/fonts/ARIAL.TTF" pdfEncoding="Cp1251" isPdfEmbedded="true"/>
                 </textElement>
                 <textFieldExpression class="java.lang.String"><![CDATA["-"]]></textFieldExpression>
             </textField>
         </band>
     </detail>
     <columnFooter>
         <band/>
     </columnFooter>
     <pageFooter>
         <band/>
     </pageFooter>
     <summary>
         <band/>
     </summary>
</jasperReport>

And when i build my report i get this error:

java.lang.ArrayIndexOutOfBoundsException: 0
     at sun.font.CompositeStrike.getStrikeForSlot(CompositeStrike.java:75)
     at sun.font.CompositeStrike.getFontMetrics(CompositeStrike.java:93)
     at sun.font.Font2D.getFontMetrics(Font2D.java:415)
     at java.awt.Font.defaultLineMetrics(Font.java:2176)
     at java.awt.Font.getLineMetrics(Font.java:2283)
     at java.awt.font.TextMeasurer.initAll(TextMeasurer.java:239)
     at java.awt.font.TextMeasurer.<init>(TextMeasurer.java:168)
     at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:310)
     at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:277)
     at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:330)
     at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:291)
     at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:991)
     at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:528)
     at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:344)
     at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:346)
     at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:305)
     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1382)
     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:692)
     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:255)
     at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:113)
     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:888)
     at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:810)
     at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:544)
     at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:63)
     at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:209)
     at java.lang.Thread.run(Thread.java:745)

Tell me please what's the problem?

How can i fix it?

Answers

This discussion has been closed.