Results 1 to 6 of 6
  1. #1
    sQu3aKy is offline Member
    Join Date
    Apr 2010
    Posts
    9
    Rep Power
    0

    Default Plz help with this Exception "AWT-EventQueue-0" error

    Hi guys,

    I am developing an instant messaging using "smack API" and Openfire as the server. I have a login GUI which contains:
    -username txtfield and password passwordfield
    -and a login button.
    ------------------------------------------------------------
    And Main GUI which contains:
    -Menubar:File, Help
    -status label with statusdropdownlist (available etc)
    -JScroller with JTree to show the users "jst like msn, yahoo etc)
    -and a logout button
    ------------------------------------------------------------
    I am able to login to the client using the correct username/password then once i click login (in the Login GUI) it will take me to the Main GUI and show this error, I am not sure wat is causing this as i kept checkin time n time again so would appreciate if someone could offer a help.
    --------------------------------------------------------------
    The loginbutton actionperformed code:

    Java Code:
     private void loginbtnActionPerformed(java.awt.event.ActionEvent evt) {                                         
            if(evt.getSource()==loginbtn){
                try {
                    loginbtn();
                } catch (XMPPException ex) {
                    System.out.println(ex);
                }
    
            }
    Java Code:
     public void loginbtn()throws XMPPException {
            user = usernametxt.getText().trim().toLowerCase();
            char [] input = passwordtxt.getPassword();
            String password = String.valueOf(input).toLowerCase();
    
            if(user.isEmpty() || password.isEmpty()) {
                  errorlbl.setText("Please type in a valid username and password");
              }else if(user.contains(" ") || password.contains(" ")){
                  errorlbl.setText("Username and password cannot contain spaces");
              }else{
                    connection.connect();
                    connection.login(user, password);
                    this.dispose();
                    new MainUI().setVisible(true);
              }
        }
    }
    --------------------------------------------------------------
    The error i get after clicking Login button:

    Java Code:
    run:
    Exception in thread "AWT-EventQueue-0" java.lang.Error: java.lang.reflect.InvocationTargetException
            at org.jdesktop.application.ApplicationAction.actionFailed(ApplicationAction.java:859)
            at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:665)
            at org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:698)
            at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
            at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
            at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
            at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
            at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
            at java.awt.Component.processMouseEvent(Component.java:6263)
            at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
            at java.awt.Component.processEvent(Component.java:6028)
            at java.awt.Container.processEvent(Container.java:2041)
            at java.awt.Component.dispatchEventImpl(Component.java:4630)
            at java.awt.Container.dispatchEventImpl(Container.java:2099)
            at java.awt.Component.dispatchEvent(Component.java:4460)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
            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.Window.dispatchEventImpl(Window.java:2478)
            at java.awt.Component.dispatchEvent(Component.java:4460)
            at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
            at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.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.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:662)
            ... 27 more
    Caused by: java.lang.IllegalStateException: Already logged in to server.
            at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:385)
            at org.jivesoftware.smack.XMPPConnection.login(XMPPConnection.java:349)
            at ChatClientMain.LoginUI.loginbtn(LoginUI.java:207)
            ... 32 more
    ------------------------------------------------------------
    Thanks in advance

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Did you look at the complete error message ?

    Caused by: java.lang.IllegalStateException: Already logged in to server.

  3. #3
    sQu3aKy is offline Member
    Join Date
    Apr 2010
    Posts
    9
    Rep Power
    0

    Default

    Thank u Eranga...I am new to java that is why and i couldn't spot that but once again rlly appreciate thnx alot.

    [SOLVED]
    Last edited by sQu3aKy; 04-28-2010 at 12:07 AM. Reason: forgot to put solved.

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    So did you fix the problem? That's on what I want to help you, and I want you to fix the problem yourself looking at the error and so on.

  5. #5
    sQu3aKy is offline Member
    Join Date
    Apr 2010
    Posts
    9
    Rep Power
    0

    Default

    Yeh, i did manage to fix...after u pointed out once again thnks and sry for wasting ur time with this silly question :)

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Replies: 5
    Last Post: 08-26-2009, 11:37 AM
  2. Replies: 4
    Last Post: 06-07-2009, 12:59 AM
  3. Replies: 3
    Last Post: 06-07-2009, 12:14 AM
  4. Replies: 12
    Last Post: 05-26-2009, 01:48 PM
  5. Replies: 10
    Last Post: 01-29-2009, 08:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •