I have no idea why this is happening, but one day it was fine. Now, I try to run the code and I get an ExceptionInInitializerError
. Here is the line that gets it:
final JButton connect = new JButton("Connect");
Stack Trace:
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
at program.gui.Chat.<init>(Chat.java:44)
at program.gui.GUI.actionPerformed(GUI.java:176)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:19
95)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
a:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242
)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:8
09)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMen
uItemUI.java:850)
at java.awt.Component.processMouseEvent(Component.java:6289)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6054)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4652)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577
)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Component.dispatchEvent(Component.java:4482)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:603)
at java.awt.EventQueue$1.run(EventQueue.java:601)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessCo
ntrolContext.java:87)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessCo
ntrolContext.java:98)
at java.awt.EventQueue$2.run(EventQueue.java:617)
at java.awt.EventQueue$2.run(EventQueue.java:615)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessCo
ntrolContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.NullPointerException
at GPAMaster.locale.Locale.get(Locale.java:30)
at GPAMaster.locale.Messages$Chat.<clinit>(Messages.java:84)
... 39 more
It looks like it's actually a problem in the static constructor for Messages.Chat
. Look into Messages.java line 84 and Locale.java line 30. Those are the relevant lines - your Chat
GUI is somewhat irrelevant, I suspect.
Without seeing that code it's hard to guess exactly what's wrong, but it could be something like not having all the localized messages for your locale.