Hello
I am creating a chart using JFreeChart in vaadin and included all the jar files like jfreechartwrapper.jar,jfreechart.jar and jcommon,jar. While writing code the application doesnot shows any error but while running it is throwing ClassNotFoundException. I am using glassfish and eclipse for cretaing the project. Any help???.
Here is my code for generating graph:
List locationList = sps.getLocations();
locationDataset=new String[locationList.size()]
;
statusDataset=new String[locationList.size()]
;
Iterator locationIterator = locationList
.iterator();
while (locationIterator.hasNext()) {
Location locs=locationIterator.next();
locationDataset[i]
=locs.getName();
statusDataset[i]
=locs.getStatus();
i++;
}
}
DefaultCategoryDataset dataset=new DefaultCategoryDataset();
for(int j=0;j<=i;j++){
dataset.addValue(j,locationDataset[j]
, statusDataset[j]
);
}
JFreeChart chart=ChartFactory.createBarChart(“Salesperson Report”, “Location”, “Status”, dataset, PlotOrientation.VERTICAL, false, true, false);
My StackTracke:
aused by: java.lang.NoClassDefFoundError: org/jfree/data/category/CategoryDataset
at forms.AdminReport$8.buttonClick(AdminReport.java:424)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:512)
… 35 more
Caused by: java.lang.ClassNotFoundException: org.jfree.data.category.CategoryDataset
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1509)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
… 41 more