aham_raw
Location : USA
Member since : Apr 11, 2005
Messages : 1
|
Apr 11, 2005 at 3:07 PM
Hi
When I use jfreechart with web server Tomcat 5.1.8 in windows environment charts work, but when the same thing I used in linux environment with resin server I found an error java.lang.NoClassDefFound Error at org.jfree.chart.ChartFactory.createLineChart(ChartFactory.java:874).
Please help me I m sending you my JSP code
<%@ page import="java.io.IOException" %>
<%@ page import="java.io.OutputStream" %>
<%@ page import="java.awt.BasicStroke" %>
<%@ page import="java.awt.Color" %>
<%@ page import="java.awt.Dimension" %>
<%@ page import="javax.swing.JPanel" %>
<%@ page import="org.jfree.chart.ChartUtilities" %>
<%@ page import="org.jfree.chart.ChartFactory" %>
<%@ page import="org.jfree.chart.ChartPanel" %>
<%@ page import="org.jfree.chart.StandardLegend" %>
<%@ page import="org.jfree.chart.JFreeChart" %>
<%@ page import="org.jfree.chart.axis.NumberAxis" %>
<%@ page import="org.jfree.chart.plot.PlotOrientation" %>
<%@ page import="org.jfree.chart.plot.CategoryPlot" %>
<%@ page import="org.jfree.chart.renderer.category.LineAndShapeRenderer" %>
<%@ page import="org.jfree.data.category.CategoryDataset" %>
<%@ page import="org.jfree.data.category.DefaultCategoryDataset" %>
<%@ page import="org.jfree.ui.ApplicationFrame" %>
<%@ page import="org.jfree.ui.RefineryUtilities" %>
<%@ page import="javax.servlet.http.HttpServlet" %>
<%@ page import="javax.servlet.http.HttpServletRequest" %>
<%@ page import="javax.servlet.http.HttpServletResponse" %>
<%@ page import="javax.servlet.ServletException" %>
<%//@ page contentType="image/png" %>
<%@ page import="java.awt.*" %>
<%@ page import="java.util.*" %>
<%
Properties prop = System.getProperties ();
prop.put ("awt.toolkit", "com.eteks.awt.PJAToolkit");
System.setProperties (prop);
System.setProperty("java.awt.headless", "true");
System.setProperty ("java.awt.graphicsenv", "com.eteks.java2d.PJAGraphicsEnvironment");
System.setProperty ("java.awt.fonts", "/usr/openwin/lib/X11/fonts/TrueType/");
OutputStream out1=response.getOutputStream();
String S1="First";
String S2="Second";
String S3="Third";
String C1="Type 1";
String C2="Type 2";
String C3="Type 3";
String C4="Type 4";
String C5="Type 5";
String C6="Type 6";
String C7="Type 7";
String C8="Type 8";
try
{
DefaultCategoryDataset dataset=new DefaultCategoryDataset();
dataset.addValue(10.0,S1,C1);
dataset.addValue(4.0,S1,C2);
dataset.addValue(null,S1,C3);
dataset.addValue(14.0,S1,C4);
dataset.addValue(-5.0,S1,C5);
dataset.addValue(-7.0,S1,C6);
dataset.addValue(14.0,S1,C7);
dataset.addValue(-3.0,S1,C8);
dataset.addValue(6.0,S2,C1);
dataset.addValue(17.0,S2,C2);
dataset.addValue(-12.0,S2,C3);
dataset.addValue(7.0,S2,C4);
dataset.addValue(7.0,S2,C5);
dataset.addValue(15.0,S2,C6);
dataset.addValue(11.0,S2,C7);
dataset.addValue(0.0,S2,C8);
JFreeChart chart=ChartFactory.createLineChart("Line Chart","Category",
"Value",dataset,PlotOrientation.VERTICAL,true,true,false);
ChartUtilities.writeChartAsJPEG(out1,chart,400,300);
}
catch(Exception e)
{
out.println(e.toString());
}
finally{
out1.close();
}
%>
I have put pja.jar and pjatool.jar file in lib directory.
So please help me if know the solution
--- Aham
|