PNG chart does not display from Solaris 2.9

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
surath
Posts: 2
Joined: Wed Mar 26, 2003 3:53 pm

PNG chart does not display from Solaris 2.9

Post by surath » Wed Mar 26, 2003 4:09 pm

Hi,
I started to use JFreeChart. Could create my demo web apps for various chart types and on Windows, the chart displays fine. When I move my servlet class files (compiled on Win XP/jdk1.4.1) and html files to Solaris 2.9 running Apache Tomcat, I could not get the PNG output on my web browser on Windows. All I get was a little red cross on top left corner.

I tried to dump a PNG file of the chart to a file on disk and that does not work either. In the following code snippet I get the println() output to Apache log file.
if (curChart != null)
{
response.setContentType("image/png");
System.out.println("Going to write the PNG output to stream.");
java.io.File png_file = new java.io.File("jfree_test.png");
ChartUtilities.saveChartAsPNG(png_file, curChart, 400, 300);
ChartUtilities.writeChartAsPNG(out, curChart, 400, 300);
}
Is there any problem for the "saveChart" and "writeChart" functions?
On Windows I do not see any of these problems.

Can any one explain what could be going wrong?

Thanks,
Surath.
Houston, TX.

xpoinsard
Posts: 5
Joined: Wed Mar 26, 2003 5:00 pm

mime type problem ?

Post by xpoinsard » Wed Mar 26, 2003 5:05 pm

I would bet on a mime type problem.
I just proposed a patch related to this for ServletUtilities.

Could you explain what you are trying to do with your code as it seems you are writing two charts, one on out and one in a file ?
Xavier Poinsard

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Mar 26, 2003 11:22 pm

Another reason might be that your server doesn't have X11 running. See this thread for info:

http://www.jfree.org/phpBB2/viewtopic.php?t=1012

Regards,

Dave Gilbert

surath
Posts: 2
Joined: Wed Mar 26, 2003 3:53 pm

X11 and JFreeChart issue

Post by surath » Thu Mar 27, 2003 5:04 am

By specifying the awt.headless=true property in catalina.sh suggested in the link provided by David, the problem is resolved.

Thanks a ton.
Surath.

Locked