JfreeChart Error Please Help

Hi,

I am trying to use the JfreeChart Wrapper in order to make a simple chart however I keep getting a HTTP status 500 error. I have been through the forums and added all the Jar files that are suggested that is all the GWT jars as well as Batik jars but still getting the same error.

Here is the code

[b]

package com.example.vaadin;

import com.vaadin.Application;
import com.vaadin.ui.;
import com.vaadin.data.
;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
import org.vaadin.addon.JFreeChartWrapper;
/**
*

  • @author Lewis Posner
  • @version
    */

public class MyApplication extends Application {

@Override
public void init() {
    
    Window main = new Window();
    setMainWindow(main);
 XYSeries series = new XYSeries("Test");
    series.add(0, 165);
    series.add(1, 150);
    series.add(2, 130);

    XYSeriesCollection dataset = new XYSeriesCollection();
    dataset.addSeries(series);
    // Generate the graph
    JFreeChart chart = ChartFactory.createXYLineChart("Testing Jfree", // Title
            "Please", // x-axis Label
            "work", // y-axis Label
            dataset, // Dataset
            PlotOrientation.VERTICAL, // Plot Orientation
            true, // Show Legend
            true, // Use tooltips
            false // Configure chart to generate URLs?
            );
    JFreeChartWrapper wrapper = new JFreeChartWrapper(chart);
 
    VerticalLayout v = new VerticalLayout();
   main.addComponent(v);
    v.addComponent(wrapper);
    v.setWidth("100%");
}
}

[/b]

Here is the error message from the Tomcat Log
[color=#f90505]

Dec 21, 2011 12:19:55 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [VaadinApplication]
in context with path
[/WebApplication3] threw exception [java.lang.NoSuchMethodError: com.vaadin.terminal.gwt.server.WebBrowser.isIE()Z]
with root cause
java.lang.NoSuchMethodError: com.vaadin.terminal.gwt.server.WebBrowser.isIE()Z
at org.vaadin.addon.JFreeChartWrapper.attach(JFreeChartWrapper.java:127)
at com.vaadin.ui.AbstractComponent.setParent(AbstractComponent.java:551)
at com.vaadin.ui.AbstractComponentContainer.addComponent(AbstractComponentContainer.java:207)
at com.vaadin.ui.AbstractOrderedLayout.addComponent(AbstractOrderedLayout.java:68)
at com.example.vaadin.MyApplication.init(MyApplication.java:52)
at com.vaadin.Application.start(Application.java:545)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.startApplication(AbstractApplicationServlet.java:1032)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:423)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:298)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
[/color]

If someone could please help me I would be really grateful.

Thanks a lot

Pozzy

Please post you web.xml too

Hi,

What version of Vaadin are you using? I remember that isIE has not been there forever. So maybe you are using some rather old Vaadin build that don’t have that method. Updating Vaadin might help.

cheers,
matti

Hi Matti,

I am new to vaadin and I am trying to use JFreeChartWrapper. but I am getting error HTTP Status 404 with description " requested resource () is not available." and message in the glassfish 2.1.1 log

INFO: Requested resource [VAADIN/APP/1/graph.svg]
not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

I am using IE9 and vaadin-6.7.3.jar . Also I got the following jars from
batik-awt-util.jar
batik-svggen.jar
batik-util.jar
batik-xml.jar
jcommon-1.0.15.jar
jfreechart-1.0.12.jar
jfreechartwrapper-2.5.0.jar

class JFreeTrial extends Window {
    public JFreeTrial() {
        super("This is a test");
        XYSeries series = new XYSeries("Sprint 1");
        series.add(0, 165);
        series.add(1, 150);
        series.add(2, 130);

        XYSeriesCollection dataset = new XYSeriesCollection();
        dataset.addSeries(series);
        // Generate the graph
        JFreeChart chart = ChartFactory.createXYLineChart("Burn Down Chart", // Title
                "days", // x-axis Label
                "Esimated Effort", // y-axis Label
                dataset, // Dataset
                PlotOrientation.VERTICAL, // Plot Orientation
                true, // Show Legend
                true, // Use tooltips
                false // Configure chart to generate URLs?
                );
        JFreeChartWrapper wrapper = new JFreeChartWrapper(chart);
        /////////////////////////////////////////////
        VerticalLayout v = new VerticalLayout();
        this.addComponent(v);
        v.addComponent(wrapper);
        v.setWidth("100%");
    }

Thank you ,

Hi,

At first glance it looks like your web.xml is somehow badly configured. The app resource ( sag file generated from jfreechart) should be requested from your app url, not from the “static file directory”.

cheers,
matti

Thank you Matti,

I was generating my Vaadin project with portlet configuration and running the project as web app. The difference in the generated servelet mapping caused the problem .

Thank you for your help :slight_smile: