ExceptionInInicializerError
-
- Posts: 11
- Joined: Tue Mar 09, 2004 9:08 pm
- Contact:
ExceptionInInicializerError
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
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
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Please post the text of the exception.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 11
- Joined: Tue Mar 09, 2004 9:08 pm
- Contact:
ExceptionInInitializerError
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)
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)
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 11
- Joined: Tue Mar 09, 2004 9:08 pm
- Contact:
ExceptionInInitializerError
<<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????
Does the others versions of jfreechart have this bug????
ExceptionInInitializerError
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 ?
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 ?
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: ExceptionInInitializerError
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?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 ?
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


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
. 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
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
The first thing to check is that org.jfree.chart.plot.LocalizationBundle.properties is in the jfreechart-0.9.18.jar file. Type:
...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.
Code: Select all
jar -tf jfreechart-0.9.18.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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


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.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
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

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 ...
That's it !!!
You're right !
"!" marks in the classpath are making these troubles !
Thanks for the investigation.
Regards
Miro
"!" marks in the classpath are making these troubles !
Thanks for the investigation.

Regards
Miro
thanks for notifying us on this bug. never heard of this before.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 ...
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...