Greetings:
I am trying to create server side charts on Linux (Apache/Tomcat). I am using jfreechart-0.5.6 and the demo WAR file from Wolfgang Irler. I get an exception thrown when I go to generate the chart. It looks like the underlying charting class is trying to get access to the X11 graphics context (which it can't get from the servlet). I have placed the exception stack trace at the end of this message.
Has anyone else experienced this? Do you know of a fix? BTW, the servlet charting demo works fine on my Apache/Tomcat setup on Windows 2000.
Thank you for any help you can offer.
-Dave Read
Here is the exception:
java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.(X11GraphicsEnvironment.java:58)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:59)
at java.awt.Font.initializeFont(Font.java:258)
at java.awt.Font.(Font.java:288)
at com.jrefinery.chart.Axis.(Unknown Source)
at com.jrefinery.chart.CategoryAxis.(Unknown Source)
at com.jrefinery.chart.HorizontalCategoryAxis.(Unknown Source)
at com.jrefinery.chart.JFreeChart.createVerticalBarChart(Unknown Source)
at com.jrefinery.chart.demo.FreeChartServlet.createChart(FreeChartServlet.java:671)
at com.jrefinery.chart.demo.FreeChartServlet.doGet(FreeChartServlet.java:839)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java:166)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:475)
Servlet Chart on Linux
RE: Servlet Chart on Linux
Hi David,
As far as I know this is a limitation of the Java2D implementation - it relies on native methods from X windows, so you have to have X running.
You can find out more at Sun's Java website, or by searching this forum for "X11".
Regards,
DG.
As far as I know this is a limitation of the Java2D implementation - it relies on native methods from X windows, so you have to have X running.
You can find out more at Sun's Java website, or by searching this forum for "X11".
Regards,
DG.
RE: Servlet Chart on Linux
congratulations, you experienced the "headless java" Problem!
According to SUN, this should be (finally) fixed with Java1.4 aka Merlin.
In the meantime, search the web for PJA (pure java awt). It's a new implementation of the awt-classes that eliminates the need for a valid display on your server. It work quite good.
Cheers
Nick
According to SUN, this should be (finally) fixed with Java1.4 aka Merlin.
In the meantime, search the web for PJA (pure java awt). It's a new implementation of the awt-classes that eliminates the need for a valid display on your server. It work quite good.
Cheers
Nick