Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have Tomcat6 running on Debian 6 in a headless server. The application deployed on this server has to generate PDF files at various points. Trying to do so results in an exception for missing fonts:

org.codehaus.groovy.grails.web.servlet.mvc.exceptions.ControllerExecutionException: Executing action [createContract] of controller [moneyfarm.cpanel.product.CPanelSubscribeController]  caused exception: java.lang.Error: Probable fatal error:No fonts found.
    at java.lang.Thread.run(Thread.java:636)
Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.Error: Probable fatal error:No fonts found.
    ... 1 more
Caused by: java.lang.Error: Probable fatal error:No fonts found.
    at org.xhtmlrenderer.context.AWTFontResolver.init(AWTFontResolver.java:58)
    at org.xhtmlrenderer.context.AWTFontResolver.<init>(AWTFontResolver.java:53)
    at org.xhtmlrenderer.layout.SharedContext.<init>(SharedContext.java:102)
    at org.xhtmlrenderer.pdf.ITextRenderer.<init>(ITextRenderer.java:111)
    at org.xhtmlrenderer.pdf.ITextRenderer.<init>(ITextRenderer.java:102)
    at company.FileDocumentService.buildPdf(FileDocumentService.groovy:166)
    ...

The oddity is that this only happens the first time after Tomcat is reloaded. After that, the application is able to locate fonts and generate the PDF files correctly.

Please, note that /etc/default/tomcat6 includes the line

JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -Xms1024m -XX:+UseConcMarkSweepGC"

so Java is started in headless mode. I have tried installing various fonts - for instance ttf-bitstream-vera without any result.

What could be going wrong? How can I try to find out?

share|improve this question
    
You need to know what fonts the application is looking for, and where it is looking for them. Can you try to enable more verbose logging to see if you get anything interesting? –  pkhamre Aug 16 '12 at 10:17
    
I can try. I actually do not define which fonts to use. I am using ITextRenderer to convert an HTML file to PDF, so I guess it tries to use the fonts declared in the HTML. I will have a look and post more details –  Andrea Aug 16 '12 at 10:23
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.