ExceptionInInicializerError

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
charlessouza
Posts: 11
Joined: Tue Mar 09, 2004 9:08 pm
Contact:

ExceptionInInicializerError

Post by charlessouza » Wed Mar 10, 2004 7:41 pm

I'm a new user at jfreechart, and I've found this exception when a new Chart is called by user, the error occurs at the "line grafico = ChartFactory..."

the code is following:

import javax.swing.*;
//import java.awt.*;
import org.jfree.chart.*;
import org.jfree.chart.plot.*;
import org.jfree.data.*;
import org.jfree.chart.renderer.*;
import org.jfree.chart.axis.*;

public class GraficoCisalhamentoDireto
{
XYSeries dados;
XYSeriesCollection colecaoDados;
JFreeChart grafico;
ChartPanel painel;

XYPlot plot;

public GraficoCisalhamentoDireto( CisalhamentoDireto cd )
{
try
{
dados = new XYSeries( "Dados", true );
for( int i = 0; i < cd.totalLinhasUsadas; i++ )
{
dados.add( Double.valueOf( cd.dados[ i ][ 3 ].toString()).doubleValue(),
Double.valueOf( cd.dados[ i ][ 6 ].toString()).doubleValue());
}

colecaoDados = new XYSeriesCollection( dados );
plot = new XYPlot( colecaoDados, new NumberAxis("X"),new NumberAxis("Y"), new StandardXYItemRenderer( StandardXYItemRenderer.LINES ));
grafico = ChartFactory.createXYLineChart( "Grafico de cisalhamento direto", "Deformação",
"Tensão cisalhante", colecaoDados,
PlotOrientation.HORIZONTAL, false, false, false );
painel = new ChartPanel( grafico );
cd.tabbed.addTab( painel );
}catch( Exception e )
{
JOptionPane.showMessageDialog( null, e + ": GraficoCisalhamentoDireto.java: linha 47" );
}
}





Thanks

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Thu Mar 11, 2004 4:32 pm

Please post the text of the exception.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

charlessouza
Posts: 11
Joined: Tue Mar 09, 2004 9:08 pm
Contact:

ExceptionInInitializerError

Post by charlessouza » Fri Mar 12, 2004 4:28 am

The exception is like this:


Exception occurred during event dispatching:

java.lang.ExceptionInInitializerError: java.util.MissingResourceException: Can't find bundle for base name org.jfree.chart.plot.LocalizationBundle, locale pt_BR

at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:712)

at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:683)

at java.util.ResourceBundle.getBundle(ResourceBundle.java:546)

at org.jfree.chart.plot.XYPlot.<clinit>(XYPlot.java:208)

at org.jfree.chart.ChartFactory.createXYLineChart(ChartFactory.java:796)

at ylocus.GraficoCisalhamentoDireto.<init>(GraficoCisalhamentoDireto.java:43)

at ylocus.YLocus2$5.actionPerformed(YLocus2.java:131)

at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)

at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)

at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)

at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)

at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)

at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:230)

at java.awt.Component.processMouseEvent(Component.java:3715)

at java.awt.Component.processEvent(Component.java:3544)

at java.awt.Container.processEvent(Container.java:1164)

at java.awt.Component.dispatchEventImpl(Component.java:2593)

at java.awt.Container.dispatchEventImpl(Container.java:1213)

at java.awt.Component.dispatchEvent(Component.java:2497)

at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)

at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)

at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)

at java.awt.Container.dispatchEventImpl(Container.java:1200)

at java.awt.Window.dispatchEventImpl(Window.java:914)

at java.awt.Component.dispatchEvent(Component.java:2497)

at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)

at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Mar 12, 2004 9:52 am

Are you using the jar files included in the distribution, or have you rebuilt them yourself? If it is the former, then there is some kind of bug that I'd like to get to the bottom of. If it is the latter, make sure you include the LocalizationBundle.properties file(s) in the jar file when you build it (the Ant script in the distribution will do this for you).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

charlessouza
Posts: 11
Joined: Tue Mar 09, 2004 9:08 pm
Contact:

ExceptionInInitializerError

Post by charlessouza » Thu Mar 18, 2004 2:43 pm

<<Are you using the jar files included in the distribution, or have you rebuilt them yourself? If it is the former, then there is some kind of bug that I'd like to get to the bottom of. If it is the latter, make sure you include the LocalizationBundle.properties file(s) in the jar file when you build it (the Ant script in the distribution will do this for you).>>


Does the others versions of jfreechart have this bug????

ezimmermann

ExceptionInInitializerError

Post by ezimmermann » Mon May 24, 2004 7:57 am

i have the ExceptionInInitializerError too, and i have tried the jar files from
the download as well as some self-compiled version (using the ant-script) under java 1.4.0 on winxp. has anyone used the jfreegraph 0.9.18 without getting the error mentioned and could give any hint ?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: ExceptionInInitializerError

Post by david.gilbert » Mon May 24, 2004 9:23 am

ezimmermann wrote:i have the ExceptionInInitializerError too, and i have tried the jar files from
the download as well as some self-compiled version (using the ant-script) under java 1.4.0 on winxp. has anyone used the jfreegraph 0.9.18 without getting the error mentioned and could give any hint ?
This problem isn't affecting a lot of people as far as I know, so my guess is that it is most likely a problem specific to a particular JDK version. Are you able to try a different version?
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

freak
Posts: 6
Joined: Mon May 24, 2004 7:51 am

Post by freak » Tue May 25, 2004 8:03 am

According to your advice i tried some other configurations. I have tested the jfreegraph 0.9.18 on win xp with jdk 1.3.8, 1.4.0 and 1.4.2 using jbuilder 9, but i was unable to get it work on aby of them. The problem is obviously that, among other classes, the ChartFactory is unable to find the org.jfree.chart.plot.LocalizationBundle.properties, both default and for de_DE locale.
. As a workaround i have copied the source code of the classes that i use together with the .properties -files into my own project and removed the path where the properties are searched in ChartFactory. This solution does work.
Since i am sure that a lot of others are using the jfreegraph-framework sucessfully i really would like to know what is going wrong, so any hint would be appreciated !

regards eddi

Mirec

Post by Mirec » Fri Jun 04, 2004 7:10 am

I have the same problem.

Freak, cak you please describe what you've done as a workaround in more detail ?

Thank you !

miro

Mirec

Post by Mirec » Fri Jun 04, 2004 7:50 am

Last working version is 0.9.11.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Jun 04, 2004 10:41 am

The first thing to check is that org.jfree.chart.plot.LocalizationBundle.properties is in the jfreechart-0.9.18.jar file. Type:

Code: Select all

jar -tf jfreechart-0.9.18.jar
...to list all the files in the jar.

If that file is there, then double-check that you don't have any other jfreechart jar files on your classpath...that can result in strange classloader errors.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

freak
Posts: 6
Joined: Mon May 24, 2004 7:51 am

Post by freak » Fri Jun 04, 2004 3:26 pm

Mirec wrote:I have the same problem.

Freak, cak you please describe what you've done as a workaround in more detail ?

Thank you !

miro
i have added the source-files (including their paths) from jfreechart that i need in my own project to the directory-structure of my project. so when i compile my classes the jfreechart classes are created at the same time.
next i added the .properties -files that are necessary to the root-dir of my classes and removed the path-data in ChartFactory source-file, so that it does no longer point anywhere into the jfreechart-dir-structure but to the root dir. the .properties -files are included when compiling. This does work as workaround, but might be not the most beautiful way :)

freak
Posts: 6
Joined: Mon May 24, 2004 7:51 am

Post by freak » Mon Jun 14, 2004 8:09 am

i have to apologize for my tests where not performed in an clean environment. the problem for not beeing able to use the jfreechart-jar file seems to be that i had my source files in a path which contained a '!' in an directory name. since java tries to resolve sources like images, property-files etc inside a jar file to a name like jar:...!... (dont know the sequence completly) that contains a '!', the '!' in my path must have disturbed this mechanism. using a path without a '!' works, so probably any special caracters should be avoided in paths ...

Mirec

That's it !!!

Post by Mirec » Mon Jun 21, 2004 9:32 am

You're right !
"!" marks in the classpath are making these troubles !

Thanks for the investigation. :-)

Regards
Miro

nikster
Posts: 46
Joined: Wed Nov 19, 2003 4:34 pm

Post by nikster » Mon Jun 21, 2004 1:29 pm

freak wrote:i have to apologize for my tests where not performed in an clean environment. the problem for not beeing able to use the jfreechart-jar file seems to be that i had my source files in a path which contained a '!' in an directory name. since java tries to resolve sources like images, property-files etc inside a jar file to a name like jar:...!... (dont know the sequence completly) that contains a '!', the '!' in my path must have disturbed this mechanism. using a path without a '!' works, so probably any special caracters should be avoided in paths ...
thanks for notifying us on this bug. never heard of this before.

it would be a good idea to file this on Sun's Java bug parade. it's really a pretty bad bug in Java, IMHO. i am sure there is a way that end-users could be affected by this, no? if they have my application in a folder with a "!" in the path...

Locked