January 28, 2004

Cocoon, Resin, JDK 1.4.2_03, Fedora Core 1 Linux

Mmmm. Trying to set this up. The hello world JPEG and PNG examples were failing with an error quite like this:

java.lang.NoClassDefFoundError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:141)
        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
        at sun.awt.font.FontResolver.<init>(FontResolver.java:46)
        at sun.awt.font.FontResolver.getInstance(FontResolver.java:120)
        at java.awt.font.TextLine.getFontAtCurrentPos(TextLine.java:984)
        at java.awt.font.TextLayout.standardInit(TextLayout.java:721)
        at java.awt.font.TextLayout.<init>(TextLayout.java:613)
        at org.apache.batik.gvt.text.BidiAttributedCharacterIterator.<init>(Unknown Source)
	...

To fix, in Resin, put <system-property java.awt.headless="true" /> in resin.conf under the <resin> tag. I am amazed this needed to be done — and more amazed that I couldn’t easily find an explanation for it with Google. Finally found it after looking at this message on resin-interest.

Update: Oops: http://cocoon.apache.org/2.1/installing/index.html#Headless+UNIX+and+PJA. Guess I should read more carefully.