Chart in Servlet Problems

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Alex Golden

Chart in Servlet Problems

Post by Alex Golden » Thu Jul 12, 2001 9:00 pm

Hi everyone - I'm trying to have my servlet return an image of a chart, but am having a problem. The line:

myChart = JFreeChart.createVerticalBarChart(dataSource)

for some reason causes the following error when I try to access the servlet:

Not Found
The requested URL /servlets/CPUUServlet was not found on this server.
Apache/1.3.9 Server at sands Port 3001

The servlet compiles fine with or without the line, but I will get this error unless I comment out the previous line. If the line is commented out then I don't get the "not found" error.. Other lines dealing with JFreeChart classes don't cause the "Not Found" error... I have jfreechart.jar in the same directory as the servlet, do I need to add it to the webserver classpath? It's running off of Apache 1.3.9 and JServ (not sure what version)...

Thanks in advance for any help,

-Alex

Ralph Brandes

RE: Chart in Servlet Problems

Post by Ralph Brandes » Tue Jul 17, 2001 2:00 pm

and the demo-servlet FreeChartServlet.java works ???
is there a ClassNotFoundException in the jserv-log ????
did you modify the jserv.properties like wrapper.classpath .... ????
i'm working with tomcat/JFreeChart on a posix-system and it runs.

Alex Golden

RE: Chart in Servlet Problems

Post by Alex Golden » Tue Jul 17, 2001 3:39 pm

No, the FreeChartServlet example does not work... I looked in the jserv.properties file but couldn't find any ClassNotFoundExceptions... I havn't made any changes to jserv configuration files, do I need
to include JFreeChart.jar in the server's classpath or something like that? I have JFreeChart.jar in the same directory as the servlet...

Thanks,

-Alex

Ralph Brandes

RE: Chart in Servlet Problems

Post by Ralph Brandes » Wed Jul 18, 2001 2:44 pm

- first: take a look in the jserv.LOG (!!) not properties to find servlet-errors.
- second: you have to tell jserv where to find the jar. if i remeber right ( i'm not working with jserv ) you must modify the jserv.properties like wrapper.classpath=C:\xxx\JFreeChart.jar
- third: JFreeChart work's fine on windows and other enviromments with an x-server. otherwise you have to use the Pure Java AWT
( see discussions in the forum )

last but not least : you should read the jserv-docs for configuration-probs ... ( sorry )

good luck

Alex Golden

RE: Chart in Servlet Problems

Post by Alex Golden » Wed Jul 18, 2001 8:21 pm

The method JFreeChart.createVerticalBarChart(myDataSource) causes the following error in jserv.log:

[18/07/2001 15:12:37:434 EDT] java.lang.NoClassDefFoundError: sun/awt/X11GraphicsEnvironment
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at org.apache.jserv.JServConnection.processRequest(Compiled Code)
at org.apache.jserv.JServConnection.run(Compiled Code)
at java.lang.Thread.run(Compiled Code)

JServ supports Servlet API 1.x I believe, do I need to run on Tomcat or another server that supports a newer version of the Servlet API? Do I need to put sun.awt.X11GraphicsEnvironment in the JServ classpath?

Thanks again for all of your help,

-Alex

Ralph Brandes

RE: Chart in Servlet Problems

Post by Ralph Brandes » Mon Jul 23, 2001 2:58 pm

see point 3 in my last response
& the thread in this forum called "sun.java2d.SunGraphicsEnvironment"
http://www.jrefinery.com/forums/read.ph ... =506&t=506

( if your jserv doesn't run on a MS-windows-system !?! ... otherwise ask again )

;-)

Locked