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
     1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     2 <html>
     3 <head>
     4 <title>Cewolf FAQ</title>
     5 <meta name="author" content="Guido Laures">
     6 <link href="../cewolf.css" rel="stylesheet" type="text/css">
     7 </head>
     8 <body>
     9 <h1>Cewolf FAQ</h1>
    10 </body>
    11 </html>
    12 
    13 
    14 <p><i>FAQ Revised: Monday 09 June 2003 23:18:38</i></p>
    15 <hr><h2>Table of Contents</h2>
    16 <dl>
    17 <dt><b>1. General</b></dt>
    18 <dd><ul>
    19 <li><a href="#General0">1.1. What is the purpose of Cewolf?</a></li>
    20 <li><a href="#General1">1.2. Who wrote it?</a></li>
    21 <li><a href="#General2">1.3. Why has Cewolf been developped?</a></li>
    22 </ul></dd>
    23 <dt><b>2. Troubleshooting</b></dt>
    24 <dd><ul>
    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>
    26 <li><a href="#Troubleshooting1">2.2. Why does the same chart display again and again even though the data changes?</a></li>
    27 </ul></dd>
    28 </dl>
    29 <hr><h2>1. General</h2>
    30 <dl>
    31 <dt><b><a name="General0">1.1. What is the purpose of Cewolf?</a></b></dt>
    32 <dd>Cewolf enables web applications running in a servlet container to easily include chart images.<br><br></dd>
    33 <dt><b><a name="General1">1.2. Who wrote it?</a></b></dt>
    34 <dd><a href="mailto:guido.laures@users.sourceforge.net">Guido Laures</a> wrote the initial program and released it.<br><br></dd>
    35 <dt><b><a name="General2">1.3. Why has Cewolf been developped?</a></b></dt>
    36 <dd>While developing a web application which needed to provide some chart images Guido 
    37 found out that there is no open source library which provides the ability to define chart images
    38 as JSP tags. So he started to write a simple tag library based on the famous JFreeChart library
    39 for standalone chart images.<br>
    40 In June 2002 Guido decided to donate his library to the public and named it Cewolf.<br><br></dd>
    41 </dl>
    42 <hr><h2>2. Troubleshooting</h2>
    43 <dl>
    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>
    45 <dd>Essentially, this is a variation of the headless Linux server problem. 
    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>
    47 
    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)
    49 startx -- :2
    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.
    51 <br>
    52 Then, all you have to do is tell Tomcat to use display 2 for painting:
    53 env DISPLAY=:2 bin/startup.sh
    54 (being in /opt/tomcat4).
    55 <br>
    56 Other posts I found helpful were:
    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>
    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>
    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>
    60 <br>
    61 Generally, try to look for 'headless' on java.sun.com (be sure to include the forums!).
    62 <br>
    63 Why didn't I use the headless option of JDK1.4?
    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. :(
    65 <br>
    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.
    67 <br>
    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>
    69 <pre>
    70 java.lang.ClassCastException: sun.awt.image.DataBufferNative
    71 at sun.awt.image.codec.JPEGImangeEncoderImpl.encode(lines 405, called from 228 and 235)
    72 at de.laures.cewolf.taglib.Renderer.renderLegend(Renderer.java:97)
    73 at de.laures.cewolf.taglib.LegendTag.doStartTag(LegendTag.java:56)
    74 at org.apache.jsp.cewolfset_jsp. and so on........
    75 </pre>
    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.
    77 <br>
    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.
    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>
    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>
    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
    82 is no change in parameters. If your DatasetProducer produces different data even when parameters do not change you can add a
    83 fake parameter (e.g. time) to avoid caching.<br>
    84 Since version 0.9 this issue has been fixed with the new methods in the DatasetProducer interface.<br><br></dd>
    85 </dl>
    86 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    87 <html>
    88 <head>
    89 </head>
    90 <body>
    91 <hr><!-- You do NOT have to keep this line below in here. I have no issue if
    92      you wish to remove it. -->
    93 <p>Copyright (c) 2003 Guido Laures<br>
    94 <i>This list of questions  and answers was generated by <a
    95  href="http://www.makefaq.org/">makefaq</a>.</i></p>
    96 </body>
    97 </html>