0

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
2
  • did you make an upgrade of java ? Commented Sep 21, 2011 at 11:25
  • I have the latest version of java Commented Sep 21, 2011 at 11:27

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

You can see a string hint of the problem down at the bottom of that stack trace:

Caused by: java.lang.NullPointerException
GPAMaster.locale.Locale.get(Locale.java:30)
    at GPAMaster.locale.Messages$Chat.<clinit>(Messages.java:84)
    ... 39 more

So this means you've got a class named Chat nested in a class named Messages, and at line 84, you call Locale.get(), which is getting a NullPointerException at line 30. The method <clinit> is the static initializer for the class Chat -- it's a compiler-generated method that contains any static blocks or initializers for static methods.

If you show us Messages.java around line 84, and Locale.java around line 30, we might be able to help more.

Comments

0

this are the key statements from the exception

Caused by: java.lang.NullPointerException at GPAMaster.locale.Locale.get(Locale.java:30) at GPAMaster.locale.Messages$Chat.<clinit>(Messages.java:84) ... 39 more:

You have a Null pointer in some static initialization code which is called before your constructor... Resolve this issue and it should work again :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.