How to use the JFreeChart Servlet ?

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

How to use the JFreeChart Servlet ?

Post by Artemis » Sat Jul 27, 2002 5:06 am

Hi,

I'm able to run the JFreeChart Demo on my PC locally.
And I want to ask how to make use of it to run on the web ?
I aim to developing a web-based charting system of time-series,
can you suggest any ways to implement it ?
Thanks a lot.

Bryan

Re: How to use the JFreeChart Servlet ?

Post by Bryan » Sat Jul 27, 2002 8:13 am

An overview of the steps

1. Install Tomcat from the apache Jakarta project
2. Install the demo war file. (It is for a currently for previous version of JFreeChart)
3. Customise the war file (web.xml) to your data source.
4. Setup demo tables in your db.

This will get the demo servlet working for you. From there it is up to you. Have a look at how the demo works and then go fo it.

NB The war is a little old, and hopefully I will be updating in the next week.

Bryan

Artemis

Re: How to use the JFreeChart Servlet ?

Post by Artemis » Sat Jul 27, 2002 9:30 am

Hi Bryan,

I've installed Tomcat and downloaded the demo war file.
But I don't know how to customise the war file,
can you show me ?

Thanks :)

Bryan

Re: How to use the JFreeChart Servlet ?

Post by Bryan » Sat Jul 27, 2002 10:02 am

Artemis

I presumed that you would like to utilise servlets because you want the charts generated and the server recieves a request. And I also presumed that you would be generating from a jdbc source?

Q's

1. Downloaded and installed Tomcat 4.x?
2. Copied war file to <Tomcat install dir>/webapps?
3. Restarted tomcat?
4. Can you open <My Tomcat Server>/JFreeServlet ?


Bryan

Artemis

Re: How to use the JFreeChart Servlet ?

Post by Artemis » Sun Jul 28, 2002 2:21 am

Hi Bryan,

Yes, you're right.

I did finish step 1.
For step 2-3, I've copied JFreeServlet.war to <Tomcat install dir>/webapps and restarted Tomcat.
But I failed to open it via http://127.0.0.1:8080/JfreeServlet
What's wrong then ?

Thanks again for your guidance.

Artemis

Artemis

Re: How to use the JFreeChart Servlet ?

Post by Artemis » Sun Jul 28, 2002 2:52 am

Oh. Sorry. I can load the JFreeServlet.

Thanks.

And which source file should I modify for my time-series chart ?

Bryan

Re: How to use the JFreeChart Servlet ?

Post by Bryan » Sun Jul 28, 2002 3:01 am

Artemis

Depends on what you are doing. If you are getting your data from a database, start by customising the web.xml file to your database.

If you are getting your data from another source start by having a look at the example included in demo directory.

Bryan

Artemis

Re: How to use the JFreeChart Servlet ?

Post by Artemis » Sun Jul 28, 2002 3:12 am

Thanks a lot.

One more question is that can I use MySQL instead of oracle as the database with JFreeServlet ?

Artemis

Bryan

Re: How to use the JFreeChart Servlet ?

Post by Bryan » Sun Jul 28, 2002 7:16 am

Artemis

Yep, you sure can. Mod the db parameters in
<Tomcat install dir>/webapps/JFreeServlet/web-inf/web.xml

The war file should also include instructions on how to setup the the demo tables in mysql (there is a script which should populate the tables from you).

Bryan

Susan

Re: How to use the JFreeChart Servlet ?

Post by Susan » Mon Jul 29, 2002 3:35 am

Hi Bryan,

I've copied JFreeServlet.war to <Tomcat install dir>/webapps and restarted Tomcat as what Artemis had done but then I get an Error 404. It doesn't seem to be able to detect the directory.

Do you happen to know what could be possibly wrong?

Thanks in advance,
Sue

Bryan

Re: How to use the JFreeChart Servlet ?

Post by Bryan » Mon Jul 29, 2002 7:59 am

Susan

Couple of things to check
1. Are you using Tomcat 4.x?
2. When tomcat restarts it should find and expand the WAR file. Do you have a JFreeServlet directory under <Tomcat install dir>/webapps
3. Can you unzip the war file (check for consistency)
4. The url is generally case sensitive

Bryan

Susan

Re: How to use the JFreeChart Servlet ?

Post by Susan » Mon Jul 29, 2002 8:54 am

Hi Bryan,

Thank you so much for the prompt reply.

1. I have installed Tomcat V4.03. During the installation of tomcat, I downloaded the binary version and unpacked it under the directory D:\jakarta-tomcat-4.0.4.

I do not seem to be able to find the index.html file of tomcat as well. It is meant to be in D:\jakarta-tomcat-4.0.4\ROOT\ but when I modified the file, the changes are not reflected on the web page. (Sorry, I know this is not a JFreeServlet question but if you happen to know whats wrong, please enlighten me. ;) )

2. When tomcat restarted, it did not expand the WAR file automatically and I do not have the JFreeServlet directory.

3. Can I expand the WAR file by unzipping it into the ..\webapp directory?

Thx,
Sue

Susan

Re: How to use the JFreeChart Servlet ?

Post by Susan » Mon Jul 29, 2002 11:05 am

Hi Bryan,

I managed to view Example 1 after reinstalling Tomcat but then Example 2 and Example 3 failed. I tried running the sql that was provided for the JDBC example but it could not run as
a) the to_date function was incorrectly used for the timestamp in the summary_data table.
b) there is an additional column, obs_code in the sql to insert data for the summary_track table.

Should the above sql script be modified. Will the codes still work after making the modifications above?

I've read in the instruction that I need to do the following:
2. Ensure that your jdbc driver is available to your servlet container. For tomcat copy to the $TOMCAT_HOME/webapps/JFreeServlet/WEB-INF/lib/ or $TOMCAT_HOME/common/lib directory

Which file do I have to copy to the above directory given that I have Oracle 8.1.7 installed? Please advice.

Thanks in advance,
Sue

Bryan

Re: How to use the JFreeChart Servlet ?

Post by Bryan » Tue Jul 30, 2002 12:49 am

Susan

1. There is an oracle and a mysql script. Please use setuptablesql.txt. Thanks for picking up the mistakes. I have corrected. update available from
http://coyote.aad.gov.au/JFreeServlet/setuptablesql.txt

2. For Oracle 8.1.7 installed?
On oracle technology network you can download the jdbc driver. the file is classes12.zip
http://otn.oracle.com/software/tech/jav ... ntent.html

Bryan

Susan

Re: How to use the JFreeChart Servlet ?

Post by Susan » Tue Jul 30, 2002 11:17 am

Hi Bryan,

Thanks!

1. I have executed the new sql script and it has been perfectly executed.

2. I was just wondering how come there are only HTML files and not JSP files. Are there are more documentation on how this sample is coded in JSP,Servlets and Beans. Would like to understand more on the software architecture.

3. I have copied the classes12.zip and extracted the classes in the $TOMCAT_HOME/webapps/JFreeServlet/WEB-INF/lib/ directory but I get an error in my tomcat. This is the error message captured in std.out
"Apache Tomcat/4.0.4
Servlet ImageSelectSQL - Driver : oracle.jdbc.driver.OracleDriver
Servlet ImageSelectSQL - Database : jdbc:oracle:thin:@test.trw.com:1521:test
Servlet ImageSelectSQL - Schema :
Servlet ImageSelectSQL - User : sys
Servlet ImageSelectSQL - Password : #######
Servlet ImageSelectSQL - Cannot find database JDBC drivers using oracle.jdbc.driver.OracleDriver - check CLASSPATH
Servlet ImageSelectSQL - select timestamp, record_count as Track from summary_track where set_code = 200102040
Servlet ImageSelectSQL - Connection failure detected - attempting to reconnect
Servlet ImageSelectSQL - Cannot find database JDBC drivers using oracle.jdbc.driver.OracleDriver - check CLASSPATH
Servlet ImageSelectSQL - Error SQL = select timestamp, record_count as Track from summary_track where set_code = 200102040 "

Thanks!

Rgds,
Susan

Locked