Wednesday, November 19, 2008

ObjectPlanet HeadlessException solution

I was getting the following exception while using the ChartServer from ObjectPlanet.

[10:32:21.796] {resin-11} java.awt.HeadlessException
[10:32:21.796] {resin-11} at java.applet.Applet.(Unknown Source)
[10:32:21.796] {resin-11} at com.objectplanet.chart.ChartApplet.(Unknown Source)
[10:32:21.796] {resin-11} at com.objectplanet.chart.BarChartApplet.(Unknown Source)
[10:32:21.796] {resin-11} at com.objectplanet.chart.ChartServlet.init(Unknown Source)
[10:32:21.796] {resin-11} at com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:830)
[10:32:21.796] {resin-11} at .......
......


On searching the Internet i found fixes related to xFree86.org and PJA in order to create a virtual AWT console for the ChartServer. But here's the simple solution -
add "-Djava.awt.headless=true" as a parameter to java.exe call.

I am using Resin, and "-Djava.awt.headless=true" added to the httpd call does not work. instead i did "httpd -Djava.awt.headless". and the headless exception disappeared.

I recommend trying both...one of these should work!