Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

NoResponseException with Smack 4.0.0-SNAPSHOT when joining MUC Room

$
0
0

I'm runnining into an issue with Smack 4.0.0-SNAPSHOT:

 

//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////

My code:

 

public class Test {

          private static final Logger logger = LoggerFactory.getLogger(Test.class.getName());

 

          public static void main(String[] args){

                   //XMPPService is a wrapper to obtain a XMPPConnection

                    XMPPService xmpp = new XMPPService("USERNAME@HOSTNAME", "PASSWORD");

 

                    XMPPConnection connection;

                    try {

                              connection = xmpp.connect();

                    } catch (XMPPException e) {

                              logger.error("Could not connect: XMPPException", e);

                              return;

                    } catch (SmackException e) {

                              logger.error("Could not connect: SmackException", e);

                              return;

                    } catch (IOException e) {

                              logger.error("Could not connect: IOException", e);

                              return;

                    }

                    assert connection.isSecureConnection();

                    logger.debug("connection established and authentication successfull!");

 

                    MultiUserChat muc = new MultiUserChat(connection, "ROOMNAME@MUCSERVICE");

                    muc.addMessageListener(new ConsumerMUCMessageListener());

 

                    try {

                              muc.join("DirkJavaTest");

                    } catch (NoResponseException e) {

                              logger.error("Could not join conversation: IOException", e);

                    } catch (XMPPErrorException e) {

                              logger.error("Could not join conversation: IOException", e);

                    } catch (NotConnectedException e) {

                              logger.error("Could not join conversation: IOException", e);

                    }

                    logger.debug("joined conversation!");

 

                    try {

                              muc.sendMessage("Hello world!");

                    } catch (NotConnectedException e) {

                              e.printStackTrace();

                    } catch (XMPPException e) {

                              e.printStackTrace();

                    }

          }

 

          private static class ConsumerMUCMessageListener implements PacketListener {

        private int messageCount=0;

 

 

        public void processPacket(Packet packet) {

            if (packet instanceof Message) {

                      Message msg = (Message)packet;           

                logger.info("Received message number : " + (messageCount++)+": "+msg.getBody());

            }

        }

        @SuppressWarnings("unused")

                    public int getMessageCount() {

            return messageCount;

        }

    }

}

 

//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////

The output:

 

apr 02, 2014 5:15:30 PM org.jivesoftware.smack.initializer.UrlProviderFileInitializer initialize

INFO: Loading providers for file [classpath:org.jivesoftware.smackx/extensions.providers]

17:15:31.841 [main] DEBUG freely.main.Test - connection established and authentication successfull!

17:15:36.852 [main] ERROR freely.main.Test - Could not join conversation: IOException

org.jivesoftware.smack.SmackException$NoResponseException: null

  at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:1 77) ~[smack-core-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]

  at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:494) ~[smack-extensions-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]

  at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:396) ~[smack-extensions-4.0.0-SNAPSHOT.jar:4.0.0-SNAPSHOT]

  at freely.main.Test.main(Test.java:44) ~[classes/:na]

17:15:36.852 [main] DEBUG freely.main.Test - joined conversation!

17:15:36.864 [Smack Listener Processor (0)] INFO  freely.main.Test - Received message number : 0: Hello world!

 

//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////

My question:

 

Why would "muc.join(NICKNAME)" throw a NoResponseException? It appears the user has successfully joined the room, when I look at the server. Also, it takes +- 5seconds before the "join" call returns, but the user was in the room immediatly at the beginning. Am I doing something wrong?


Viewing all articles
Browse latest Browse all 10742

Trending Articles