#999 HeadlessException with headless=true and JRE 1.6.0_20-b02

Steffen Ewert

Since yesterday I get for my JSF application (running on tomcat) a java.awt.HeadlessException while calling ChartFactory.createXYStepChart(...). java.awt.headless is set to true.

Here my Code:

System.out.println("_________________java.awt.headless is " + System.getProperty("java.awt.headless"));
// create the chart:
JFreeChart chart = ChartFactory.createXYStepChart(
null, null, "%", dataset, PlotOrientation.VERTICAL, true, false, false);

And here a part of the exception:

_________________java.awt.headless is true
at sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:64)
at com.birosoft.liquid.skin.SkinImageCache.<clinit>(SkinImageCache.java:45)
at com.birosoft.liquid.LiquidLookAndFeel.loadIconImmediately(LiquidLookAndFeel.java:638)
at com.birosoft.liquid.LiquidLookAndFeel.loadIcon(LiquidLookAndFeel.java:626)
at com.birosoft.liquid.LiquidLookAndFeel.initComponentDefaults(LiquidLookAndFeel.java:461)
at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(BasicLookAndFeel.java:130)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:514)
at javax.swing.UIManager.setLookAndFeel(UIManager.java:558)
at javax.swing.UIManager.initializeDefaultLAF(UIManager.java:1317)
at javax.swing.UIManager.initialize(UIManager.java:1406)
at javax.swing.UIManager.maybeInitialize(UIManager.java:1394)
at javax.swing.UIManager.getDefaults(UIManager.java:633)
at javax.swing.UIManager.getColor(UIManager.java:675)
at org.jfree.chart.JFreeChart.<clinit>(JFreeChart.java:261)
at org.jfree.chart.ChartFactory.createXYStepChart(ChartFactory.java:1803)
at cow.k7progress.useCases.report.chart.UCGenerateScheduleRealObjectChart.start(UCGenerateScheduleRealObjectChart.java:161)

Interesting are the "com.birosoft...." lines in the stacktrace. I have never heared something about birosoft. Then I have check in which jar the com.birosoft classes are stored and have find out that the jar is .../jre/lib/ext/liquidInf.jar of the JRE 1.6.0_20-b02. It seems that the JRE 1.6.0_20-b02 was installed some days ago (may be a automatic update ...). The JRE 1.6.0_17 don't have this liquidInf.jar. I have switched back to the JRE 1.6.0_17 and all running fine without any Exceptions ... :-)

I run my JSF-application in tomcat on a openSuse 11.2 (this is my development machine; tomcat will be started over the eclipse IDE).

See also http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=30073

Could you check if this is a bug in JFree or a bug of JRE 1.6.0_20 or is something other wrong with my installation?

Do you need more information? Please contact me.



  • Thomas Morgner
    Thomas Morgner

    • status: open --> closed-invalid
  • Thomas Morgner
    Thomas Morgner

    This is a bug in your Look-And-Feel. Someone installed that Look-And-Feel in your JDK's installation directory and apparently your application manually activates it (as a custom look-and-feel is not used unless you explicitly request it.) This seems to be a clear bug in their implementation, as a call to UIManager.getDefaults() must never result in a error.


  • Anonymous

    I have the same problem. When I'm SSH-ing remotely to my application that uses JFreeChart and using it to generate a chart to a PNG file, I get:

    at java.awt.GraphicsEnvironment.createGE\(GraphicsEnvironment.java:118\)
    at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment\(GraphicsEnvironment.java:81\)
    at sun.swing.SwingUtilities2.isLocalDisplay\(SwingUtilities2.java:1457\)
    at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults\(MetalLookAndFeel.java:1556\)
    at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults\(BasicLookAndFeel.java:148\)
    at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults\(MetalLookAndFeel.java:1592\)
    at javax.swing.UIManager.setLookAndFeel\(UIManager.java:535\)
    at javax.swing.UIManager.setLookAndFeel\(UIManager.java:575\)
    at javax.swing.UIManager.initializeDefaultLAF\(UIManager.java:1343\)
    at javax.swing.UIManager.initialize\(UIManager.java:1432\)
    at javax.swing.UIManager.maybeInitialize\(UIManager.java:1420\)
    at javax.swing.UIManager.getDefaults\(UIManager.java:655\)
    at javax.swing.UIManager.getColor\(UIManager.java:697\)
    at org.jfree.chart.JFreeChart.&lt;clinit&gt;\(JFreeChart.java:258\)
    at org.jfree.chart.ChartFactory.createXYLineChart\(ChartFactory.java:1748\)

    Inspecting the JFreeChart code, specifically:


    it appears that there is a static field:

    public static final Paint DEFAULT_BACKGROUND_PAINT = UIManager.getColor("Panel.background");

    Apparently, getting the color from the UI manager cannot be done remotely without a UI session (this also happens to me if the display goes into screen saving mode).
    I am running this on Mac OS X Lion, Oracle JVM 1.7, update 9. I don't think this is a UI manager problem.

    This is the only place in that file that the UIManager is used. Perhaps it would make sense to fix this somehow or suggest a workaround - apparently, it makes it impossible to use JFreeChart other than from a UI.

    Last edit: Anonymous 2014-03-20

  • Anonymous

    Even if you don't fix this, showing a workaround would be great!