SmackException $ NoResponseException on XMPPTCPConnection.login (Smack-4.1.0)

Environment:

  • Server: OpenFire v3.9.3.
  • Client OS: Linux
  • OS Server: Linux
  • Java: 1.8.0_40
  • Smack: smack-core-4.10, smack-im-4.1.0, smack-tcp-4.1.0, smack-sasl-provided-4.1.0

Here is my test client code:

public class XMPPClientTest
{
    public static void main(String[] args)
    {

        XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
                .setHost("xmpp.domain")
                .setServiceName("xmpp.domain")
                .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
                .setDebuggerEnabled(true)
                .setResource("Smack-client")
                .build();

        AbstractXMPPConnection conn1 = new XMPPTCPConnection(config);
        try
        {
            System.out.println("connecting");
            conn1.connect();
            System.out.println("connected");

            System.out.println("logging in");
            conn1.login("user", "password");
            System.out.println("logged in");

            ChatManager chatmanager = ChatManager.getInstanceFor(conn1);
            Chat newChat = chatmanager.createChat("user@xmpp.domain");

            newChat.sendMessage("Goodbye World!");
            conn1.disconnect();
        }
        catch (IOException | SmackException | XMPPException ioe)
        {
            ioe.printStackTrace();
        }
    }
}

Here is the conclusion

connecting
11:49:40 AM SENT (0): <stream:stream xmlns='jabber:client' to='xmpp.domain' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
11:49:40 AM RECV (0): <?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="xmpp.domain" id="3d0a3800" xml:lang="en" version="1.0">
11:49:40 AM RECV (0): <stream:features><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls"></starttls><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/></stream:features>
logging in
11:49:40 AM SENT (0): <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'>=</auth>
11:49:40 AM RECV (0): <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09InhtcHAua2lkY2hlY2suY29tIixub25jZT0iYXpqS2N3UUh3S2RjTTVQeWt4OEo2YmdsM1VoMk9JQkVTallBWXFLOSIscW9wPSJhdXRoIixjaGFyc2V0PXV0Zi04LGFsZ29yaXRobT1tZDUtc2Vzcw==</challenge>
org.jivesoftware.smack.SmackException$NoResponseException: No response received within reply timeout. Timeout was 5000ms (~5s). Used filter: No filter used or filter was 'null'.
    at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:106)
    at org.jivesoftware.smack.SmackException$NoResponseException.newWith(SmackException.java:85)
    at org.jivesoftware.smack.SASLAuthentication.authenticate(SASLAuthentication.java:250)
    at org.jivesoftware.smack.tcp.XMPPTCPConnection.loginNonAnonymously(XMPPTCPConnection.java:365)
    at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:452)
    at org.jivesoftware.smack.AbstractXMPPConnection.login(AbstractXMPPConnection.java:427)
    at com.forge.label.app.driver.test.XMPPClientTest.main(XMPPClientTest.java:39)
Apr 07, 2015 11:49:45 AM org.jivesoftware.smack.AbstractXMPPConnection callConnectionClosedOnErrorListener
WARNING: Connection closed with error
java.lang.NullPointerException
    at org.jivesoftware.smack.util.stringencoder.Base64.decode(Base64.java:86)
    at org.jivesoftware.smack.sasl.SASLMechanism.challengeReceived(SASLMechanism.java:229)
    at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication.java:328)
    at org.jivesoftware.smack.SASLAuthentication.challengeReceived(SASLAuthentication.java:313)
    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.parsePackets(XMPPTCPConnection.java:1040)
    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader.access$200(XMPPTCPConnection.java:937)
    at org.jivesoftware.smack.tcp.XMPPTCPConnection$PacketReader$1.run(XMPPTCPConnection.java:952)
    at java.lang.Thread.run(Thread.java:745)

I can connect to the server using IM clients like Pidgin. But when I try to use the Smack library, I get the above errors. The only "solution" I found for this problem was to call XMPPTCPConnectionConfiguration.setSecurityMode (SecurityMode.disabled), but that did not work in my case.

From the debug output, a message appears stating that the server is making a call and the client is ignoring it.

Any help would be appreciated.

+4
2

pom.xml

.

    <dependency>
       <groupId>org.igniterealtime.smack</groupId>
       <artifactId>smack-extensions</artifactId>
       <version>4.1.4</version>
    </dependency>
0

Xmpp smack connect(). . ( ).

xmpp connect(). , . , , ConnectionListener :

XMPPTCPConnection connection = new XMPPTCPConnection(config);
    connection.addConnectionListener(new ConnectionListener() {

        @Override
        public void reconnectionSuccessful() {
        }

        @Override
        public void reconnectionFailed(Exception arg0) {
        }

        @Override
        public void reconnectingIn(int arg0) {
        }

        @Override
        public void connectionClosedOnError(Exception arg0) {
        }

        @Override
        public void connectionClosed() {
        }

        @Override
        public void connected(XMPPConnection arg0) {
            System.out.println("Connected to xmpp service....");
            try {
                connection.login("username", "password");
                System.out.println("Logged in to xmpp service....");
            } catch (Exception e) {
                e.printStackTrace();
            }

        }

        @Override
        public void authenticated(XMPPConnection arg0, boolean arg1) {
            // TODO Auto-generated method stub

        }
    });
    connection.connect();
-1

All Articles