Need help: 3.6.1 and the JRFontNotFoundException

0

I have read through the sample code included in 3.6.1 (demo/samples/fonts). 

I modified my jasperreports.properties file to include:

net.sf.jasperreports.export.pdf.fontdir.jasper=/path/to/truetype/files/

 

However, when I run my existing reports, attempting to generate PDF, I get: 

net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'BlairITC TT' is not available to the JVM. See the Javadoc for more details.
   at net.sf.jasperreports.engine.util.JRStyledText.getAwtAttributedString(JRStyledText.java:228) 

 I am not currently using the Spring framework, and would rather not have to deal with that. Is my only option to now programatically create an instance of 'SimpleFontFamily', and set all of the propeties (name, normal, italic, pdfEncoding, pdfEmbedded, etc.) on that object. Then add the object to the JRFiller?

Is there an example showing that approach instead? I was really hoping this would be as simple as specifying the directory of my TrueType fonts...

jbuberel's picture
Joined: Sep 3 2006 - 8:38am
Last seen: 7 years 12 months ago

25 Answers:

0

Here is one fix that I have tried, but which did not work:

        JRProperties.setProperty("net.sf.jasperreports.export.pdf.fontdir.jasper", "/home/jason/svn/trunk/lib/fonts/");
        JRProperties.setProperty("net.sf.jasperreports.export.pdf.font.BlairITC TT.Normal","/home/jason/svn/trunk/lib/fonts/BlairMdITCTTMedium.ttf");
        JasperExportManager.exportReportToPdfStream(pFilledReport, pOut);

The exception I am still getting is:

net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'BlairITC TT' is not available to the JVM. See the Javadoc for more details.
  at net.sf.jasperreports.engine.util.JRStyledText.getAwtAttributedString(JRStyledText.java:228) 
  at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:353) 
  at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:1003)
  at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:542) 
jbuberel's picture
Joined: Sep 3 2006 - 8:38am
Last seen: 7 years 12 months ago
0

Hi,

 

This exception was introduced in JR 3.6.1 so that is more obvious to our users that they are creating reports using fonts that are not available on the machines that run those reports.

Very many problems that are reported on these forums are related to misuse of fonts in reports.

 

You get this error because you are using fontName="BlairITC TT" in your reports and this particular font is not available to the JVM that renders your report.

 

You have two options here:

1. configure JR to ingnore missing fonts and continue using what is basically an invalid report template, which is missing an important resource: the font.

You can do this by setting the net.sf.jasperreports.awt.ignore.missing.font=true in the jasperreports.properties file or as a custom property in that particular report template.

Note that this is not recomended as unpredictable results will be obtained when the JVM will use some other font to calculate your report layout.

 

2. Package the TTF files that make up the BlairTC TT font into a JAR that represents a JR font extension and add it to your application classpath. This will make the font available to the JVM and thus the report will work properly on all machines.

The easiest way to do so is to rely on a few Spring JARs and package your fonts the same way we did with the DejaVu fonts that we ship under the /demo/fonts sample. Note the fonts.xml file in the folder hierachy. If you don't want to use Spring, you would need to implement some JR extensions interfaces. You could do so by looking into the implementations that are already shipped as part of JR, and follow the Javadoc.

 

Note that exception is related to fonts being used with AWT, at report fill time and they do not have to do with PDF. What you have tried are some PDF-related settings that are nowadays deprecated, as PDF font mappings are done in the font extensions as well.

 

The easiest way to create font extensions is by using iReport 3.6.1, which comes with a TTF install wizard and a font export tool, in the Tools/Options/iReport/Fonts menu.

 

I hope this helps.

Teodor

 

teodord's picture
2855
Joined: Jun 30 2006 - 9:00am
Last seen: 2 months 4 weeks ago
0

After a day spent walking through the Jasper source in the debugger, I finally found the critical error.

I had modified my jasperreports_extensions.properties file to contain a reference to the factory and my fonts.xml file (trying to replicate the appraoch taken in the 'Fonts' sample code). In my first attempt, the resulting file after ant variable substitution looked like this:

net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistry
net.sf.jasperreports.extension.fonts.spring.beans.resource=/home/jason/svn/trunk/classes/fonts.xml

NOTE: The pathname to the 'fonts.xml' file is a full pathname. This version resulted in none of my custom font declarations being found by or made available to the JVM.

On a whim, I then modified the location of the fonts.xml file and the reference to it so that both would end up in the same directory after compliation (/home/jason/svn/trunk/classes), and to use the following relative path to the fonts.xml file:

net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistry
net.sf.jasperreports.extension.fonts.spring.beans.resource=fonts.xml

This had the desired effect - it caused the SpringExtensionsRegistry to load, parse, and process my fonts.xml file. In that file, I then defined fonts such as, where the ant macro @CLASSES@ is expanded at compile time to the complete canonical path to the TTF file. The use of the full pathname in this file did not have any negative side effect. However, at some point I will reformulate this to use a relative pathname.:

    <bean id="blairITCFontFamily" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily">
        <property name="name" value="BlairITC TT"/>
        <property name="normal" value="@CLASSES@/BlairMdITCTTMedium.ttf"/>
        <property name="bold" value="@CLASSES@/BlairITCTTBold.ttf"/>
        <property name="pdfEncoding" value="Identity-H"/>
        <property name="pdfEmbedded" value="true"/>
        <property name="exportFonts">
            <map>
                <entry key="net.sf.jasperreports.html">
                    <value>Arial, Helvetica, sans-serif</value>
                </entry>
                <entry key="net.sf.jasperreports.xhtml">
                    <value>Arial, Helvetica, sans-serif</value>
                </entry>
            </map>
        </property>
    </bean>
 

So everything is now back to normal :)

jbuberel's picture
Joined: Sep 3 2006 - 8:38am
Last seen: 7 years 12 months ago
0

Hi,

 

I don't understand why you work with absolute file locations on disk.

The path to the fonts.xml file should be its path within classpath, not path on disk.

 

This is why I told you font extensions are packaged in JAR. If you use absolute file names, packaging the font extension in a JAR does not make any sense anymore.

 

Thanks,

Teodor

 

teodord's picture
2855
Joined: Jun 30 2006 - 9:00am
Last seen: 2 months 4 weeks ago
0

Hey,

thank you for the JAR-tip in iReport.

I just want to add a bug report:

 

The jasperreports_extension.properties in the generated JAR-file has a wrong path to the fonts**.xml in the sub-directory "fonts".

It references the XML-file with a beginning Slahs (/fonts/fonts**.xml) which is wrong, I had to manualy remove this slash or it will end in an exception when starting JBoss and Jasper is creating its registries.

 

Yours sincerely,

Martin

 

funtax's picture
1
Joined: Oct 21 2009 - 4:59am
Last seen: 4 years 10 months ago
0

Hi, Martin

 

I've let Giulio know about this and he'll look into it.

It would not hurt if you would actually log an iReport bug for this on the iReport trackers.

This way it will be marked as done in preparation for the next release.

 

Thank you,

Teodor

 

teodord's picture
2855
Joined: Jun 30 2006 - 9:00am
Last seen: 2 months 4 weeks ago
0

Hi,

I am new to Jasper Reports and have to upgrade an existing implementation from 3.5.2 to 3.6.2.

After doing the upgrade, some of our existing reports now fail with the JRFontNotFoundException as described in this thread.

I can avoid the exception by setting the ...ignore.missing.font=true as described above.  As far as I understand, this will restore the previous behavior ... where no checking was done.  However, I would rather fix it "properly" if possible.

As far as I know, my report definitions make no (intentional) effort to use any specific or custom fonts whatsoever.  When I get the exception, it refers to the "sansserif" font e.g.

net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'sansserif' is not available to the JVM. See the Javadoc for more details.

I get this problem both in iReport and when running the report through my application. 

Should I be seeing this problem for this font?  Or does it indicate something else wrong.

Unfortunately I'm not very up on the whole area of fonts and Jasper in general ... just trying to upgrade to the latest version without doing any damage ... so any comments/explanations would be most welcome.

Thanks.

 

 

jhnz's picture
1
Joined: Nov 30 2009 - 6:55pm
Last seen: 4 years 9 months ago
0

Hi,

 

The easiest "fix" you could do would be to use "SansSerif". In the past, the default value for fontName was not correct in iR/JR.

 

But if you want a more solid fix, then I suggest you replace everywhere you have fontName="SOME_SANS_FONT" with fontName="DejaVu Sans" and everywhere you have fontName='SOME_SERIF_FONT" with fontName="DejaVu Serif".

You also remove everywhere the pdfFontName, pdfEncoding and isPdfEmbedded, as these are now deprecated and dealt with in the font extension JARs.

 

You then add the jasperreports-fonts-xxx.jar file to the classpath of your application, because it contains a font extension that provides the above mentioned DejaVu fonts. You can download this font JAR from the same location where you find the JasperReports JAR or project ZIP, at Sourceforge.net.

 

You would have to give your reports a sanity check again, to see if all texts appear OK, paying special attention to static texts which might have a height that is too small for the new fonts to render properly. In such cases, you either need to increase the height a bit or reduce font size.

 

If you never played with fonts before, it means you did not generate reports in other languages than English or you did not export to PDF. Because if you did, then you must have used some TTF fonts that support the particular language you used in those reports.

 

I hope this helps.

Teodor

 

teodord's picture
2855
Joined: Jun 30 2006 - 9:00am
Last seen: 2 months 4 weeks ago
0

Everything works fine on my developer system since there seem to be all fonts installed on that Windows box. The customer runs a SuSE Linux Enterprise server and I ran into the discussed problem after upgrading to 3.6.2.

The quick hack with net.sf.jasperreports.awt.ignore.missing.font=true succeeded but I am interested in a real solution because I have space problems due to missing fonts.

I packed a JAR with Arial TTFs and also tried the jar with the DejaVu font from sourceforge. Unfortunately I get an exception when one of the font jars is within the classpath:

javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser; nested exception is: java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser
java.lang.RuntimeException: java.lang.NoClassDefFoundError: Could not initialize class net.sf.jasperreports.engine.util.JRStyledTextParser
    at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)
    at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
    at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
    at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)

Without the font jars everything works fine. I read this indicates that different library versions are used. I did a grep in my jboss installation but there is version 3.6.2 installed only.

 

pinnau's picture
3
Joined: Nov 24 2009 - 7:23am
Last seen: 7 months 2 days ago
0

Hi,

 

I think the exception must have a cause down the stack trace. I suspect it is about the Spring jars missing.

The font extension is a Spring-based extension and needs those extra JARs that you can find in the /lib directory of the JR project distribution package.

 

I hope this helps.
Teodor

 

teodord's picture
2855
Joined: Jun 30 2006 - 9:00am
Last seen: 2 months 4 weeks ago
0

can it be that "exportFonts" attribute is no longer available in SimpleFontFamily in 3.6.2? If not, the example (fonts.xml) should be modified to not include that.

 

Furthermore i have a severe problem with the font jar extension mechanism when trying to load OTF fonts. 

To my knowledge this should work from java perspective.

 

System: Java6 on Mac OS X.



Post Edited by loge at 12/15/2009 22:10
loge's picture
46
Joined: Apr 23 2009 - 5:37am
Last seen: 5 years 4 months ago
0

Hi,

 

The exportFonts method is still there in latest versions. What is the problem you experience with it?

 

I'm not aware of any way of loading OFT font files in Java.

If you have expertise in this area, please contribute.

 

Thanks,

Teodor

 

 

teodord's picture
2855
Joined: Jun 30 2006 - 9:00am
Last seen: 2 months 4 weeks ago
0

hi ,

 

 

got a small qn

ive already designed some 40 odd reports with the 'pdffontname' attribute and removing that from every report becomes cumbersome.. is there any way that these reports would run fine(with desired fonts) on a linux server just by adding the font extensions jar to the appn classpath

madhukiran's picture
Joined: May 20 2009 - 1:53am
Last seen: 2 weeks 7 hours ago
0

 Hi

I trying to generate at report with a ttf font, but also get the JRFontNotFoundException.

I trying to use the DejaVu Sans font.

I using Java EE 6 on Glassfish 3.0. iReport 3.7.1, JasperReport 3.7.1

 

<font fontName="DejaVu Sans" isUnderline="false" isPdfEmbedded="true"/>

I used Tools/Options/iReport/Fonts to import and "export as extension"

I generate jasperreports-fonts-DejaVu Sans.jar and I put in WEB-INF\\lib

 

The jasperreports-fonts-DejaVu Sans.jar contains:

- fonts
     - DejaVuSans.ttf
     - fonts1273221481231.xml
- jasperreports_extension.properties

 

fonts1273221481231.xml:

 <?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xsi:schemaLocation="http://www.springframework.org/schema/beans

           http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

 

   <bean id="fontBean127322148123753178" class="net.sf.jasperreports.engine.fonts.SimpleFontFamily">

       <property name="name" value="DejaVu Sans"/>

       <property name="normal" value="fonts/DejaVuSans.ttf"/>

       <property name="pdfEmbedded" value="true"/>

   </bean>

</beans>

 
jasperreports_extension.properties:
net.sf.jasperreports.extension.registry.factory.fonts=net.sf.jasperreports.extensions.SpringExtensionsRegistryFactory
net.sf.jasperreports.extension.fonts.spring.beans.resource=fonts/fonts1273221481231.xml
 
What am I doing wrong and what have I missed?

 

tofa's picture
6
Joined: Apr 8 2010 - 12:26am
Last seen: 4 years 4 months ago
0
I had missed to add jasperreports-font, spring-bean and spring-core.
It works now!
tofa's picture
6
Joined: Apr 8 2010 - 12:26am
Last seen: 4 years 4 months ago
0
i removed all the pdf tags manully in the all the jrxml, but while exporting to PDF, the bond text are not appering, it appering as normal font, but when i export into xlsx, it working fine.

Can you pleae tell me what need to be done to make sure the bond is appering in the PDF format
balap6's picture
10
Joined: Nov 21 2007 - 4:31am
Last seen: 4 months 11 hours ago
0

Hi,

 

For bold font in PDF, you need to use a bold TTF font. Check again your font extension (if you use one) and make sure that for bold font you specify a TTF that is really bold. Otherwise, the engine will use the same TTF as for the normal/regular font, hence the problem.

Same thing for italic and bold/italic.

Note that in case you don't have a special bold font file to use, the boldness can be simulated in PDF.

But all this works only if you use fonts from a font extension. Check the samples under /demo/samples in the JR distro and especially the font extension that we ship with the project under /demo/fonts.

 

iReport has a wizard to create font extension JARs, to deploy with your reports.

 

I hope this helps.

Teodor

 

teodord's picture
2855
Joined: Jun 30 2006 - 9:00am
Last seen: 2 months 4 weeks ago
0

maybe you could do by

1: Tools->Options->Fonts->Install Font-> ......next....

2: After step 1, then click Export as extension to a jar file.

3: Go to Tools->Options->Classpath to add the jar thar you generated.

 

rommy123's picture
Joined: Dec 19 2010 - 6:37pm
Last seen: 3 years 8 months ago
0

I've read all the postings on this subject.

I have generated my Arial.jar file which contains the arial.ttf family fonts.  This jar along with the jasperreports-3.7.3,  spring-2.5 jars are located on my WAS classpath.  When I attempt to generate a report, I get the following exception:

[1894435 --- 12628]2011-02-24 13:39:06,914] [DEBUG]: - Instantiating extensions registry class net.sf.jasperreports.extensions.DefaultExtensionsRegistry
[1894435 --- 12628]2011-02-24 13:39:06,920] [DEBUG]: - Loading registries for cache key sun.misc.Launcher$AppClassLoader@755f755f
[1894435 --- 12628]2011-02-24 13:39:06,922] [DEBUG]: - Found resource jasperreports_extension.properties at jar:file:/opt/was61/AppServer/profiles/Appsrv01/installedApps/cvgrheespd002Node01Cell/ESpecApp.ear/jasperreports-3.7.3.jar!/jasperreports_extension.properties in classloader sun.misc.Launcher$AppClassLoader@755f755f
[1894435 --- 12628]2011-02-24 13:39:06,923] [DEBUG]: - Found resource jasperreports_extension.properties at jar:file:/opt/was61/AppServer/profiles/Appsrv01/installedApps/cvgrheespd002Node01Cell/ESpecApp.ear/Arial.jar!/jasperreports_extension.properties in classloader sun.misc.Launcher$AppClassLoader@755f755f
[1894435 --- 12628]2011-02-24 13:39:06,924] [DEBUG]: - Loading JasperReports extension properties resource jar:file:/opt/was61/AppServer/profiles/Appsrv01/installedApps/cvgrheespd002Node01Cell/ESpecApp.ear/jasperreports-3.7.3.jar!/jasperreports_extension.properties
[1894435 --- 12628]2011-02-24 13:39:06,926] [DEBUG]: - Instantiating registry of type net.sf.jasperreports.extensions.DefaultExtensionsRegistryFactory for property net.sf.jasperreports.extension.registry.factory.default
[1894435 --- 12628]2011-02-24 13:39:06,926] [DEBUG]: - Instantiating extensions registry for default using factory class net.sf.jasperreports.extensions.DefaultExtensionsRegistryFactory
[1894435 --- 12628]2011-02-24 13:39:06,927] [DEBUG]: - Instantiating registry of type net.sf.jasperreports.governors.GovernorExtensionsRegistryFactory for property net.sf.jasperreports.extension.registry.factory.governor
[1894435 --- 12628]2011-02-24 13:39:06,927] [DEBUG]: - Instantiating extensions registry for governor using factory class net.sf.jasperreports.governors.GovernorExtensionsRegistryFactory
[1894435 --- 12628]2011-02-24 13:39:06,928] [DEBUG]: - Instantiating registry of type net.sf.jasperreports.components.ComponentsExtensionsRegistryFactory for property net.sf.jasperreports.extension.registry.factory.components
[1894435 --- 12628]2011-02-24 13:39:06,928] [DEBUG]: - Instantiating extensions registry for components using factory class net.sf.jasperreports.components.ComponentsExtensionsRegistryFactory
[1894435 --- 12628]2011-02-24 13:39:06,951] [DEBUG]: - Loading JasperReports extension properties resource jar:file:/opt/was61/AppServer/profiles/Appsrv01/installedApps/cvgrheespd002Node01Cell/ESpecApp.ear/Arial.jar!/jasperreports_extension.properties
[1894435 --- 12628]2011-02-24 13:39:06,952] [DEBUG]: - Instantiating registry of type net.sf.jasperreports.extensions.SpringExtensionsRegistryFactory for property net.sf.jasperreports.extension.registry.factory.fonts
[1894435 --- 12628]2011-02-24 13:39:06,952] [DEBUG]: - Instantiating extensions registry for fonts using factory class net.sf.jasperreports.extensions.SpringExtensionsRegistryFactory
[1894435 --- 12628]2011-02-24 13:39:07,009] [ERROR]: - Error instantiating extensions registry for fonts
net.sf.jasperreports.engine.JRRuntimeException: Could not find Spring resource /fonts/fonts1298566395082.xml for extensions registry fonts
 at net.sf.jasperreports.extensions.SpringExtensionsRegistryFactory.getBeanFactory(SpringExtensionsRegistryFactory.java:91)
 at net.sf.jasperreports.extensions.SpringExtensionsRegistryFactory.createRegistry(SpringExtensionsRegistryFactory.java:73)
 at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.instantiateRegistry(DefaultExtensionsRegistry.java:238)
 at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.loadRegistries(DefaultExtensionsRegistry.java:213)
 at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.loadRegistries(DefaultExtensionsRegistry.java:162)
 at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getRegistries(DefaultExtensionsRegistry.java:132)
 at net.sf.jasperreports.extensions.DefaultExtensionsRegistry.getExtensions(DefaultExtensionsRegistry.java:104)
 at net.sf.jasperreports.engine.util.JRStyledTextParser.<clinit>(JRStyledTextParser.java:76)
 at java.lang.J9VMInternals.initializeImpl(Native Method)
 at java.lang.J9VMInternals.initialize(J9VMInternals.java:194)
 at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:181)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:76)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:86)
 at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:56)
 at net.sf.jasperreports.engine.fill.JRFiller.createFiller(JRFiller.java:142)
 at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:78)
 at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
 at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:513)
 at net.sf.jasperreports.engine.JasperFillManager.fillReportToFile(JasperFillManager.java:465)
 at com.acnielsen.espec.bo.util.ExportDataToReportUtility.generateShellValuesReport(ExportDataToReportUtility.java:465)
 at com.acnielsen.espec.bo.util.ExportDataToReportUtility.generateJasperReport(ExportDataToReportUtility.java:137)
 at com.acnielsen.espec.bo.reports.ReportsBO.getReportsBO(ReportsBO.java:109)
 at com.acnielsen.espec.bo.reports.ScheduleLaterService.generateReportNow(ScheduleLaterService.java:434)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:618)
 at com.acnielsen.espec.bo.reports.ScheduleLaterService.run(ScheduleLaterService.java:195)
 at com.acnielsen.standalone.main.ESpecReportsMain.main(ESpecReportsMain.java:51)

Any assistance would be greatly appreciated.

I've attached my Arial.jar file for reference.

 

lpennings's picture
Joined: Feb 24 2011 - 11:32am
Last seen: 3 years 6 months ago
0

Hi,

The problem might be caused by the first slash in the /fonts/fonts1298566395082.xml path in the jasperreports_extension.properties file.
Try to replace the

/fonts/fonts1298566395082.xml

with

fonts/fonts1298566395082.xml

Hope this helps,
sanda

shertage's picture
762
Joined: Sep 26 2006 - 8:06pm
Last seen: 2 months 1 week ago
0

Thank you Sanda for the help...that was the issue.

 

The new exception is:

[1894492 --- 8036]2011-02-25 11:49:08,367] [ERROR]: - No input source supplied to the exporter.
com.acnielsen.arch.exception.arch.ACNException: No input source supplied to the exporter.
 at com.acnielsen.espec.bo.util.ExportDataToReportUtility.exportAsExcel(ExportDataToReportUtility.java:235)
 at com.acnielsen.espec.bo.util.ExportDataToReportUtility.generateJasperReport(ExportDataToReportUtility.java:138)
 at com.acnielsen.espec.bo.reports.ReportsBO.getReportsBO(ReportsBO.java:109)
 at com.acnielsen.espec.bo.reports.ScheduleLaterService.generateReportNow(ScheduleLaterService.java:434)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:618)
 at com.acnielsen.espec.bo.reports.ScheduleLaterService.run(ScheduleLaterService.java:195)
 at com.acnielsen.standalone.main.ESpecReportsMain.main(ESpecReportsMain.java:51)
Caused by:
net.sf.jasperreports.engine.JRException: No input source supplied to the exporter.
 at net.sf.jasperreports.engine.JRAbstractExporter.setInput(JRAbstractExporter.java:845)
 at net.sf.jasperreports.engine.export.JRXlsAbstractExporter.exportReport(JRXlsAbstractExporter.java:169)
 at com.acnielsen.espec.bo.util.ExportDataToReportUtility.exportAsExcel(ExportDataToReportUtility.java:227)
 ... 9 more
 

 

This report worked perfectly fine prior to the upgrade.

Any ideas?

 

lpennings's picture
Joined: Feb 24 2011 - 11:32am
Last seen: 3 years 6 months ago
0
Some additional debugging information.

[INFO ]: - Loading XML bean definitions from URL [file:/opt/was61/AppServer/profiles/Appsrv01/installedApps/cvgrheespd002Node01Cell/ESpecApp.ear/fonts/fonts1298566395082.xml]
[DEBUG]: - Using JAXP provider [org.apache.xerces.jaxp.DocumentBuilderFactoryImpl]
[DEBUG]: - Trying to resolve XML entity with public id [null] and system id [http://www.springframework.org/schema/beans/spring-beans-2.0.xsd]
[DEBUG]: - Loading schema mappings from [META-INF/spring.schemas]
[DEBUG]: - Loaded schema mappings: {http://www.springframework.org/schema/lang/spring-lang-2.5.xsd=org/sprin..., http://www.springframework.org/schema/lang/spring-lang.xsd=org/springframework/scripting/config/spring-lang-2.5.xsd, http://www.springframework.org/schema/context/spring-context-2.5.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/jms/spring-jms-2.5.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/context/spring-context.xsd=org/springframework/context/config/spring-context-2.5.xsd, http://www.springframework.org/schema/aop/spring-aop.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/util/spring-util-2.0.xsd=org/springframework/beans/factory/xml/spring-util-2.0.xsd, http://www.springframework.org/schema/util/spring-util-2.5.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool-2.0.xsd=org/springframework/beans/factory/xml/spring-tool-2.0.xsd, http://www.springframework.org/schema/tx/spring-tx-2.0.xsd=org/springframework/transaction/config/spring-tx-2.0.xsd, http://www.springframework.org/schema/tool/spring-tool-2.5.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx-2.5.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.0.xsd=org/springframework/beans/factory/xml/spring-beans-2.0.xsd, http://www.springframework.org/schema/jms/spring-jms.xsd=org/springframework/jms/config/spring-jms-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans-2.5.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/beans/spring-beans.xsd=org/springframework/beans/factory/xml/spring-beans-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/tool/spring-tool.xsd=org/springframework/beans/factory/xml/spring-tool-2.5.xsd, http://www.springframework.org/schema/tx/spring-tx.xsd=org/springframework/transaction/config/spring-tx-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.0.xsd=org/springframework/ejb/config/spring-jee-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.0.xsd=org/springframework/aop/config/spring-aop-2.0.xsd, http://www.springframework.org/schema/aop/spring-aop-2.5.xsd=org/springframework/aop/config/spring-aop-2.5.xsd, http://www.springframework.org/schema/jee/spring-jee-2.5.xsd=org/springframework/ejb/config/spring-jee-2.5.xsd, http://www.springframework.org/schema/lang/spring-lang-2.0.xsd=org/springframework/scripting/config/spring-lang-2.0.xsd, http://www.springframework.org/schema/util/spring-util.xsd=org/springframework/beans/factory/xml/spring-util-2.5.xsd}
[1894492 --- 8036]2011-02-25 11:49:07,824] [DEBUG]: - Found XML schema [http://www.springframework.org/schema/beans/spring-beans-2.0.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-2.0.xsd
[DEBUG]: - Loading bean definitions
[DEBUG]: - Found 1 beans for extension type interface net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Creating shared instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Creating instance of bean 'fontBean12985663950821242' with merged definition [Root bean: class [net.sf.jasperreports.engine.fonts.SimpleFontFamily]; scope=singleton; abstract=false; lazyInit=false; autowireCandidate=true; autowireMode=0; dependencyCheck=0; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in URL [file:/opt/was61/AppServer/profiles/Appsrv01/installedApps/cvgrheespd002Node01Cell/ESpecApp.ear/fonts/fonts1298566395082.xml]]
[DEBUG]: - Eagerly caching bean 'fontBean12985663950821242' to allow for resolving potential circular references
[DEBUG]: - Getting BeanInfo for class [net.sf.jasperreports.engine.fonts.SimpleFontFamily]
[DEBUG]: - Caching PropertyDescriptors for class [net.sf.jasperreports.engine.fonts.SimpleFontFamily]
[DEBUG]: - Found bean property 'boldItalicFace' of type [net.sf.jasperreports.engine.fonts.FontFace]
[DEBUG]: - Found bean property 'boldFace' of type [net.sf.jasperreports.engine.fonts.FontFace]
[DEBUG]: - Found bean property 'italicPdfFont' of type [java.lang.String]
[DEBUG]: - Found bean property 'pdfEmbedded' of type [java.lang.Boolean]
[DEBUG]: - Found bean property 'name' of type [java.lang.String]
[DEBUG]: - Found bean property 'locales' of type [java.util.Set]
[DEBUG]: - Found bean property 'pdfEncoding' of type [java.lang.String]
[DEBUG]: - Found bean property 'italicFace' of type [net.sf.jasperreports.engine.fonts.FontFace]
[DEBUG]: - Found bean property 'bold' of type [java.lang.String]
[DEBUG]: - Found bean property 'boldItalicPdfFont' of type [java.lang.String]
[DEBUG]: - Found bean property 'italic' of type [java.lang.String]
[DEBUG]: - Found bean property 'normalFace' of type [net.sf.jasperreports.engine.fonts.FontFace]
[DEBUG]: - Found bean property 'class' of type [java.lang.Class]
[DEBUG]: - Found bean property 'boldPdfFont' of type [java.lang.String]
[DEBUG]: - Found bean property 'boldItalic' of type [java.lang.String]
[DEBUG]: - Found bean property 'normal' of type [java.lang.String]
[DEBUG]: - Found bean property 'defaultExportFont' of type [java.lang.String]
[DEBUG]: - Found bean property 'normalPdfFont' of type [java.lang.String]
[DEBUG]: - Found bean property 'exportFonts' of type [java.util.Map]
[DEBUG]: - Converting String to [class java.lang.Boolean] using property editor [org.springframework.beans.propertyeditors.CustomBooleanEditor@6ba76ba7]
[DEBUG]: - Fill 906769932: created for SHELL_VALUES_REPORT
[DEBUG]: - Fill 906769932: filling report
[DEBUG]: - Found 0 beans for extension type interface net.sf.jasperreports.engine.scriptlets.ScriptletFactory
[DEBUG]: - Fill 906769932: adding page 1
[DEBUG]: - Fill 906769932: title
[DEBUG]: - Fill 906769932: creating subreport filler
[DEBUG]: - Fill 535502827: created for SHELL_VALUES_REPORT_CLNT
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Fill 906769932: starting 535502827
[DEBUG]: - Fill 535502827: starting thread Thread[SHELL_VALUES_REPORT_CLNT subreport filler,5,main]
[DEBUG]: - Fill 535502827: waiting for fill result
[DEBUG]: - Fill 535502827: filling report
[DEBUG]: - Fill 535502827: no data
[DEBUG]: - Fill 535502827: all sections
[DEBUG]: - Fill 535502827: column header
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Getting bean fontBean12985663950821242 as extension of type net.sf.jasperreports.engine.fonts.FontFamily
[DEBUG]: - Returning cached instance of singleton bean 'fontBean12985663950821242'
[DEBUG]: - Fill 535502827: ended
[DEBUG]: - Fill 535502827: notifying of completion
[DEBUG]: - Fill 535502827: notified of fill result
[DEBUG]: - Fill 906769932: subreport 535502827 finished
[DEBUG]: - Fill 906769932: ended
[AUDIT]: - Report generation failed..No input source supplied to the exporter.
[WARN ]: - No input source supplied to the exporter.
lpennings's picture
Joined: Feb 24 2011 - 11:32am
Last seen: 3 years 6 months ago
0

I've figured out what the issue with the no input source found.

The offending code is trying to set the PROPERTY_WRAP_TEXT, boolean.FALSE.

the code is as follows:new JExcelApiExporter();

JExcelApiExporter xlsExporter =

xlsExporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile.toString());new HashMap();if (jasperPrint.getName().equalsIgnoreCase("DroppedUpc") || jasperPrint.getName().equalsIgnoreCase("InstructionSummary"))"65000"));

As soon as the HashMap (m) is set to the parameters, all the previously set parameters are wiped out.  Can someone give me some direction on how to set the PROPERTY_WRAP_TEXT properly?  Any help is greatly appreciated.  Thank you.

xlsExporter.setParameter(JRExporterParameter.INPUT_FILE_NAME, destFile.toString());

xlsExporter.setParameter(JRXlsExporterParameter.INPUT_FILE, sourceFile);

xlsExporter.setParameter(JRXlsExporterParameter.IS_ONE_PAGE_PER_SHEET, Boolean.FALSE);

xlsExporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_COLUMNS, Boolean.TRUE);

 

m.put(JRXlsExporterParameter.PROPERTY_WRAP_TEXT,Boolean.FALSE);

xlsExporter.setParameters(m);

 

xlsExporter.setParameter(JRXlsExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);

xlsExporter.setParameter(JRXlsExporterParameter.MAXIMUM_ROWS_PER_SHEET, Integer.decode(

xlsExporter.setParameter(JRXlsExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.FALSE);

xlsExporter.exportReport();

lpennings's picture
Joined: Feb 24 2011 - 11:32am
Last seen: 3 years 6 months ago
0

Can someone help me understand the subject of PROPERTY_TEXT_WRAP?  I'm seeing that when the data populated in the cell is larger than the cell width, the text is wrapped.   Simply put, if the column definition is 50 and the data returned to the cell is 100, the text will wrap.  Even if I put the property_text_wrap.False, the text still wraps. 

Does anyone have any idea how to prevent text from wrapping?

Any assistance would be greatly appreciated!

lpennings's picture
Joined: Feb 24 2011 - 11:32am
Last seen: 3 years 6 months ago
0

Hi

Even I am using Sans Sarif or DejaVu Sans, I am getting exception for Times Roman, I didn't use Times Roman anywhere in my report. Coul you please advise how do I fix this problem? I am using iReport/Jasperreport 4.1.1 and jdk 7

net.sf.jasperreports.engine.util.JRFontNotFoundException: Font 'Times-Roman' is not available to the JVM. See the Javadoc for more details.
    at net.sf.jasperreports.engine.util.JRFontUtil.checkAwtFont(JRFontUtil.java:358)
    at net.sf.jasperreports.engine.util.JRStyledText.getAwtAttributedString(JRStyledText.java:226)
    at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:326)
    at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:510)
    at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:593)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:328)

Please help.

Mortoza

 

mortoza's picture
36
Joined: Oct 13 2006 - 1:42pm
Last seen: 1 month 1 week ago
Feedback
randomness