Home pageFind It!Contact PJAPJA documentation

PJA

 PJA Toolkit forum

This forum is dedicated to PJA Toolkit.
You may read freely the messages it contents. If you want to write a message or answer to a subject, subscribe to it first.

Subjects Recent messages Login Subscribe

Messages of subject java.lang.ExceptionInInitializerError: java.lang.ClassCastException: com.eteks.awt.PJAToolkit

renwo009

Member since : Oct 20, 2004
Messages : 1
 Oct 21, 2004 at 6:40 AM
Attempting to launch an application installer HP-UX B 11.00 but am receiving the following error / feedback:
JDK 1.3.1

java.lang.ExceptionInInitializerError: java.lang.ClassCastException: com.eteks.awt.PJAToolkit
at sun.java2d.loops.RasterOutputManager.(RasterOutputManager.java:253)
at sun.awt.image.BufferedImageGraphicsConfig.getOutputManager(BufferedImageGraphicsConfig.java:53)
at sun.awt.image.BufferedImageGraphics2D.getOutputManager(BufferedImageGraphics2D.java:336)
at sun.java2d.SunGraphics2D.validatePipe(SunGraphics2D.java:332)
at sun.java2d.pipe.ValidatePipe.fill(ValidatePipe.java:114)
at sun.java2d.SunGraphics2D.fill(SunGraphics2D.java:1616)
at org.jfree.chart.JFreeChart.draw(JFreeChart.java:845)
at org.jfree.chart.JFreeChart.createBufferedImage(JFreeChart.java:1040)
at org.jfree.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:196)
at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:337)
at org.jfree.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:302)
at org.jfree.chart.servlet.ServletUtilities.saveChartAsPNG(ServletUtilities.java:141)
at org.jfree.chart.servlet.ServletUtilities.saveChartAsPNG(ServletUtilities.java:110)
at forecast.servlet.ForecastImage.service(ForecastImage.java:70)

**************ForecastImage.java Start ********************************

package forecast.servlet;

import java.io.*;
import javax.servlet.http.*;
import org.jfree.chart.*;
import org.jfree.chart.plot.*;
import org.jfree.chart.axis.*;
import org.jfree.chart.servlet.*;
import org.jfree.ui.*;
import org.jfree.data.*;

import monitor.common.ComLogBean;

public class ForecastImage extends HttpServlet {

private static final String CHART_FILENAME_KEY = "matsu.sample.savedFileName";
private static final String PUBLIC_CHART_TEMPFILE_PREFIX = "public-jfreechart-";
private static final String DEFAULT_CHART_TEMPFILE_PREFIX = "jfreechart-";

protected void service(HttpServletRequest req, HttpServletResponse res)
throws IOException {

int width = 640;
int height = 640;

// ƒZƒbƒVƒ‡ƒ“‚Ì?擾(‚È‚¯‚ê‚Î?ì?¬)
HttpSession session = req.getSession(true);

String preTempFilePrefix = ServletUtilities.getTempFilePrefix();
String[] publicFlagParams = req.getParameterValues ("public");
if (publicFlagParams != null
&& publicFlagParams.length > 0
&& publicFlagParams[0].equals("true")) {
if (!preTempFilePrefix.equals(PUBLIC_CHART_TEMPFILE_PREFIX)) {
ComLogBean.writeLog("change tempFilePrefix from [" + preTempFilePrefix + "] to [");
ServletUtilities.setTempFilePrefix(PUBLIC_CHART_TEMPFILE_PREFIX);
ComLogBean.writeLog(ServletUtilities.getTempFilePrefix() + "]");
session.removeAttribute(CHART_FILENAME_KEY);
// session.removeAttribute("JFreeChart_Deleter");
}
} else if (preTempFilePrefix.equals(PUBLIC_CHART_TEMPFILE_PREFIX)){
ComLogBean.writeLog("change tempFilePrefix from [" + preTempFilePrefix + "] to [");
ServletUtilities.setTempFilePrefix(DEFAULT_CHART_TEMPFILE_PREFIX);
ComLogBean.writeLog(ServletUtilities.getTempFilePrefix() + "]");
session.removeAttribute(CHART_FILENAME_KEY);
// session.removeAttribute("JFreeChart_Deleter");
}

// ƒOƒ‰ƒt‚ðƒtƒ@ƒCƒ‹•Û‘¶‚·‚é?Û‚Ì?Ý’è‚ðŠm”F
ComLogBean.writeLog("tmpFileDir = " + System.getProperty("java.io.tmpdir"));
ComLogBean.writeLog("tmpFilePrefix = " + ServletUtilities.getTempFilePrefix());

String savedFileName = null;
try {
savedFileName = (String)session.getAttribute(CHART_FILENAME_KEY);
} catch (ClassCastException e) {
savedFileName = null;
}

if (savedFileName == null) {
try {
// –_ƒOƒ‰ƒt‚ÌJFreeChart‚ð?ì?¬
JFreeChart chart = createChart();

// ?Q?l‚Ü‚Å‚ÉChartDeleter‚ª‚ ‚é‚©‚Ç‚¤‚©Šm”F‚µ‚Ä‚Ý‚é
ChartDeleter chartDeleter = (ChartDeleter) session.getAttribute("JFreeChart_Deleter");
ComLogBean.writeLog("chartDeleter before saveChart = " + chartDeleter);

// ƒOƒ‰ƒt‚ðPNGŒ`?®‚Ńtƒ@ƒCƒ‹•Û‘¶
savedFileName = ServletUtilities.saveChartAsPNG(chart, width, height, session);
ComLogBean.writeLog("savedFileName = " + savedFileName);
session.setAttribute(CHART_FILENAME_KEY, savedFileName);

// ?Q?l‚Ü‚Å‚ÉChartDeleter‚ª‚ ‚é‚©‚Ç‚¤‚©Šm”F‚µ‚Ä‚Ý‚é
chartDeleter = (ChartDeleter) session.getAttribute("JFreeChart_Deleter");
ComLogBean.writeLog("chartDeleter before saveChart = " + chartDeleter);

} catch (IOException e) {
e.printStackTrace();
}
}

try {
res.setContentType("text/html");
PrintWriter out = new PrintWriter(res.getOutputStream());
out.println("<a href=\"./display_chart?filename=" + savedFileName + "\">generated chartimage (" + savedFileName + ")</a>");
out.close();
} catch (IOException e) {
e.printStackTrace();
}
return;
}

/**
* –_ƒOƒ‰ƒt‚ÌJFreeChart‚ð?ì?¬‚·‚é.
*/
private JFreeChart createChart () {
// –_ƒOƒ‰ƒt‚̃f?[ƒ^
double[][] data = new double[][]
{{1.0, 2.0, 3.0, 4.0},
{5.0, 6.0, 7.0, 8.0},
{9.0, 10.0, 11.0, 12.0},
{13.0, 14.0, 15.0, 16.0}};
// CategoryDatasetƒIƒuƒWƒFƒNƒg‚Ì?ì?¬
CategoryDataset cData = DatasetUtilities.createCategoryDataset("RowKey ", "ColKey ", data);
// CategoryDataset‚ðƒf?[ƒ^‚É‚µ‚ÄJFreeChart‚ð?ì?¬
JFreeChart barChart = ChartFactory.createBarChart ("SampleBarChart",
"categoryAxisLabel",
"valueAxisLabel",
cData, PlotOrientation.VERTICAL,
false, false, false);
return barChart;
}

}

*********************ForecastImage.java End************************


Please give me some advice.

Yunming Wei.

Manu

Location : Paris / France
Member since : Apr 29, 2003
Messages : 394
 Oct 21, 2004 at 10:30 PM
You should use JDK 1.3.1.02 or better.
---
Manu (moderator/modérateur)


Home pageFind It!ContactTop

© Copyrights 1997-2023 eTeks - All rights reserved

PJAPJA documentation