java/cewolf-1.0/src/site/faq/faq.html
author František Kučera <franta-hg@frantovo.cz>
Sun, 01 Mar 2009 11:06:49 +0100
changeset 4 249560bcc466
parent 1 639991d0808a
permissions -rw-r--r--
Doplnění serializovatelnosti
franta-hg@1
     1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
franta-hg@1
     2
<html>
franta-hg@1
     3
<head>
franta-hg@1
     4
<title>Cewolf FAQ</title>
franta-hg@1
     5
<meta name="author" content="Guido Laures">
franta-hg@1
     6
<link href="../cewolf.css" rel="stylesheet" type="text/css">
franta-hg@1
     7
</head>
franta-hg@1
     8
<body>
franta-hg@1
     9
<h1>Cewolf FAQ</h1>
franta-hg@1
    10
</body>
franta-hg@1
    11
</html>
franta-hg@1
    12
franta-hg@1
    13
franta-hg@1
    14
<p><i>FAQ Revised: Monday 09 June 2003 23:18:38</i></p>
franta-hg@1
    15
<hr><h2>Table of Contents</h2>
franta-hg@1
    16
<dl>
franta-hg@1
    17
<dt><b>1. General</b></dt>
franta-hg@1
    18
<dd><ul>
franta-hg@1
    19
<li><a href="#General0">1.1. What is the purpose of Cewolf?</a></li>
franta-hg@1
    20
<li><a href="#General1">1.2. Who wrote it?</a></li>
franta-hg@1
    21
<li><a href="#General2">1.3. Why has Cewolf been developped?</a></li>
franta-hg@1
    22
</ul></dd>
franta-hg@1
    23
<dt><b>2. Troubleshooting</b></dt>
franta-hg@1
    24
<dd><ul>
franta-hg@1
    25
<li><a href="#Troubleshooting0">2.1. I'm using Cewolf under Unix/Linux. When trying to access a chart I get a NoClassDefFoundError. What am I doing wrong?</a></li>
franta-hg@1
    26
<li><a href="#Troubleshooting1">2.2. Why does the same chart display again and again even though the data changes?</a></li>
franta-hg@1
    27
</ul></dd>
franta-hg@1
    28
</dl>
franta-hg@1
    29
<hr><h2>1. General</h2>
franta-hg@1
    30
<dl>
franta-hg@1
    31
<dt><b><a name="General0">1.1. What is the purpose of Cewolf?</a></b></dt>
franta-hg@1
    32
<dd>Cewolf enables web applications running in a servlet container to easily include chart images.<br><br></dd>
franta-hg@1
    33
<dt><b><a name="General1">1.2. Who wrote it?</a></b></dt>
franta-hg@1
    34
<dd><a href="mailto:guido.laures@users.sourceforge.net">Guido Laures</a> wrote the initial program and released it.<br><br></dd>
franta-hg@1
    35
<dt><b><a name="General2">1.3. Why has Cewolf been developped?</a></b></dt>
franta-hg@1
    36
<dd>While developing a web application which needed to provide some chart images Guido 
franta-hg@1
    37
found out that there is no open source library which provides the ability to define chart images
franta-hg@1
    38
as JSP tags. So he started to write a simple tag library based on the famous JFreeChart library
franta-hg@1
    39
for standalone chart images.<br>
franta-hg@1
    40
In June 2002 Guido decided to donate his library to the public and named it Cewolf.<br><br></dd>
franta-hg@1
    41
</dl>
franta-hg@1
    42
<hr><h2>2. Troubleshooting</h2>
franta-hg@1
    43
<dl>
franta-hg@1
    44
<dt><b><a name="Troubleshooting0">2.1. I'm using Cewolf under Unix/Linux. When trying to access a chart I get a NoClassDefFoundError. What am I doing wrong?</a></b></dt>
franta-hg@1
    45
<dd>Essentially, this is a variation of the headless Linux server problem. 
franta-hg@1
    46
    If there are any Linux wizards out there (I use SuSE 7.1) to point out better solutions, I'd be happy to hear them.<br>
franta-hg@1
    47
franta-hg@1
    48
I was not quite convinced it would be the same problem many other people had, since I _have_ an X server running. However, it is sitting there, idling away with KDM (the KDE Display Manager), and I could not find a way to make that display available to java. I tried to connect to it, tried to set xhost +, but no avail. In the end, I used (as root)
franta-hg@1
    49
startx -- :2
franta-hg@1
    50
to start another X server on display :2 (localhost is implied). Unfortunately, startx will start KDE, so the libraries are loaded into memory, but that is a minor annoyance. There might be a possibility of starting just the X server or a minor window manager (twm for example), but I tried with env WANTEDWM=twm startx -- :2 &, but KDE got loaded anyway. In essence, the Xvfb solution might just be the thing I use next time.
franta-hg@1
    51
<br>
franta-hg@1
    52
Then, all you have to do is tell Tomcat to use display 2 for painting:
franta-hg@1
    53
env DISPLAY=:2 bin/startup.sh
franta-hg@1
    54
(being in /opt/tomcat4).
franta-hg@1
    55
<br>
franta-hg@1
    56
Other posts I found helpful were:
franta-hg@1
    57
<a href="http://www.object-refinery.com/phorum-3.3.2a/read.php?f=2&i=2987&t=2987">http://www.object-refinery.com/phorum-3.3.2a/read.php?f=2&i=2987&t=2987</a>
franta-hg@1
    58
<a href="http://forum.java.sun.com/thread.jsp?forum=4&thread=201773">http://forum.java.sun.com/thread.jsp?forum=4&thread=201773</a>
franta-hg@1
    59
<a href="http://forum.java.sun.com/thread.jsp?forum=20&thread=132877">http://forum.java.sun.com/thread.jsp?forum=20&thread=132877</a>
franta-hg@1
    60
<br>
franta-hg@1
    61
Generally, try to look for 'headless' on java.sun.com (be sure to include the forums!).
franta-hg@1
    62
<br>
franta-hg@1
    63
Why didn't I use the headless option of JDK1.4?
franta-hg@1
    64
Of course I tried, but the Cewolf classes include a call to de.laures.cewolf.util.ImageHelper, which in its static initializer will throw a headless exception. I verified this under NT and Linux. :(
franta-hg@1
    65
<br>
franta-hg@1
    66
One good method to troubleshoot is to call the servlet directly: in IE, right-click on the image (presumably missing, otherwise you wouldn't be here...), choose Properties, select the whole path and copy the path into the address line. Call this, and you will get a stack trace detailing the problem. However, it might be necessary to reload the application in between - somehow, only the stack trace of the first call is useful, the next calls to the same servlet will result in a much more generic (bland) error message.
franta-hg@1
    67
<br>
franta-hg@1
    68
With the method above I was able to use the Cewolf.war files from versions 0.7, 0.8 and 0.8.1. However, only the testpage worked satisfyingly in all cases. The Cewolf set in some circumstances created a<br>
franta-hg@1
    69
<pre>
franta-hg@1
    70
java.lang.ClassCastException: sun.awt.image.DataBufferNative
franta-hg@1
    71
at sun.awt.image.codec.JPEGImangeEncoderImpl.encode(lines 405, called from 228 and 235)
franta-hg@1
    72
at de.laures.cewolf.taglib.Renderer.renderLegend(Renderer.java:97)
franta-hg@1
    73
at de.laures.cewolf.taglib.LegendTag.doStartTag(LegendTag.java:56)
franta-hg@1
    74
at org.apache.jsp.cewolfset_jsp. and so on........
franta-hg@1
    75
</pre>
franta-hg@1
    76
This is in 0.8.1. In the cewolfset of 0.7, most charts render fine, except for the last two, where it says 'Separate legend befor chart rendering' [sic] and 'Pie Chart with separate legend after chart rendering'. Both charts render fine, but the legends don't. Using above mentioned technique to render the servlet alone (the path is localhost:8080/Cewolf-0.7/cewolf?id=pie&action=renderlegend), the known ClassCastException appears again.
franta-hg@1
    77
<br>
franta-hg@1
    78
The one thing I still don't get is why my own application does not work on Linux, even though I use the exact same war file on NT without problems. I just get the empty windows, no stack traces in any logs, and calling the servlets alone gets the ClassCastException again, even though I don't think I do anything differently than in the testpage code.
franta-hg@1
    79
I just tried to do it under JDK1.4.1_01, but no change (except that the ClassCastException doesn't mention sun.awt.image.DataBufferNative anymore). JDK1.3 might work (I get to see the complete Cewolfset, including the legends), only that I get another error in my DataProvider in a call to Calendar.setTimeInMillis (was protected in 1.3 and is public in 1.4). This error message was what prompted me to switch over to 1.4 in the first place... But I can fix that. Or wait until the casting problem is solved.<br><br></dd>
franta-hg@1
    80
<dt><b><a name="Troubleshooting1">2.2. Why does the same chart display again and again even though the data changes?</a></b></dt>
franta-hg@1
    81
<dd>A DatasetProducer is supposed to generate the same data when passed in the same paramters. So Cewolf returns a cached instance of a chart if there
franta-hg@1
    82
is no change in parameters. If your DatasetProducer produces different data even when parameters do not change you can add a
franta-hg@1
    83
fake parameter (e.g. time) to avoid caching.<br>
franta-hg@1
    84
Since version 0.9 this issue has been fixed with the new methods in the DatasetProducer interface.<br><br></dd>
franta-hg@1
    85
</dl>
franta-hg@1
    86
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
franta-hg@1
    87
<html>
franta-hg@1
    88
<head>
franta-hg@1
    89
</head>
franta-hg@1
    90
<body>
franta-hg@1
    91
<hr><!-- You do NOT have to keep this line below in here. I have no issue if
franta-hg@1
    92
     you wish to remove it. -->
franta-hg@1
    93
<p>Copyright (c) 2003 Guido Laures<br>
franta-hg@1
    94
<i>This list of questions  and answers was generated by <a
franta-hg@1
    95
 href="http://www.makefaq.org/">makefaq</a>.</i></p>
franta-hg@1
    96
</body>
franta-hg@1
    97
</html>