Error in smack 4.2.0: IN AAAA returned the error NX_DOMAIN

I launched openFire and tested it with a spark, everything is fine, but when I try to connect to smack 4.2.0 in android studio, I got this error:

Ljavax / naming / directory / InitialDirContext;

and my dependencies are as follows:

compile "org.igniterealtime.smack: smack-java7: 4.2.0" compile compile org.igniterealtime.smack: smack-tcp: 4.2.0 "org.igniterealtime.smack: smack-im: 4.2.0" compile "org. igniterealtime.smack: smack-extensions: 4.2.0 "compile" org.igniterealtime.smack: smack-android-extension: 4.2.0 "compile" Org.igniterealtime.smack: slap-bosh: 4.2.0 "

when remove this: "compile org.igniterealtime.smack: smack-java7: 4.2.0" from the dependencies and add this: compile "org.igniterealtime.smack: smack-android: 4.2.0" my dependencies become like this:

compile 'com.android.support:appcompat-v7:24.0.0' compile "org.igniterealtime.smack: smack-android: 4.2.0" compile Compile org.igniterealtime.smack: smack-tcp: 4.2.0 "org. igniterealtime.smack: smack-im: 4.2.0 "compile" org.igniterealtime.smack: smack-extensions: 4.2.0 "compile" org.igniterealtime.smack: smack-android-extension: 4.2.0 "compile" Org. igniterealtime.smack: Slap Bosch: 4.2.0 "

I got this error:

org.jivesoftware.smack.SmackException $ConnectionException: : '192.168.209.2:5222' , : de.measite.minidns.hla.ResolutionUnsuccessfulException: 192.168.209.2. IN A NX_DOMAIN, '192.168.209.2:5222' , : de.measite.minidns.hla.ResolutionUnsuccessfulException: 192.168.209.2. IN AAAA NX_DOMAIN

, connect.connect():

XMPPTCPConnectionConfiguration config = null;  
            try {  
                config = XMPPTCPConnectionConfiguration.builder()  
                        .setUsernameAndPassword("admin", "thepass")  
                        .setXmppDomain("192.168.1.3")  
                        .setHost("192.168.209.2")  
                        .setPort(5222)  
                        .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)  
                        .build();  
            } catch (Exception e) {  
                e.printStackTrace();  
            }  
                AbstractXMPPConnection conn1 = new XMPPTCPConnection(config);  
                conn1.setReplyTimeout(60000);  
                conn1.setPacketReplyTimeout(60000);  
                conn1.connect();  
+6
2

, , XMPP.

:

ejabberd : 192.168.209.2 #ejabberd

xmpp "localhost". JID,

"davood @localhost" "sadegh @localhost"

smack, , , "davood @localhost". :

            InetAddress addr = InetAddress.getByName("192.168.209.2");
            HostnameVerifier verifier = new HostnameVerifier() {
                @Override
                public boolean verify(String hostname, SSLSession session) {
                    return false;
                }
            };
            DomainBareJid serviceName = JidCreate.domainBareFrom("localhost");
            XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
                    .setHost(server) # it will be resolved by setHostAddress method
                    .setUsernameAndPassword("davood","mypass")
                    .setPort(5222)
                    .setSecurityMode(ConnectionConfiguration.SecurityMode.disabled)
                    .setXmppDomain(serviceName)
                    .setHostnameVerifier(verifier)
                    .setHostAddress(addr)
                    .setDebuggerEnabled(true)
                    .build();
            AbstractXMPPConnection conn1 = new XMPPTCPConnection(config);

            conn1.connect();

            if(conn1.isConnected()){
                Log.d("XMPP","Connected");
            }
            conn1.login();

            if(conn1.isAuthenticated()){
                Log.d("XMPP","Authenticated");
                EntityBareJid jid = JidCreate.entityBareFrom("sadegh@localhost");
                org.jivesoftware.smack.chat2.Chat chat = ChatManager.getInstanceFor(conn1).chatWith(jid);
                chat.send("Eureka, I am connected!");


            }
+11

, : https://github.com/igniterealtime/Smack/wiki/Smack-4.2-Readme-and-Upgrade-Guide

Smack ConnectionConfiguration.setHost(String) IP- XMPP. DNSSEC. ConnectionConfiguration.setHostAddress(InetAddress).

.

, : de.measite.minidns.hla.ResolutionUnsuccessfulException: xxxx. IN AAAA NX_DOMAIN

+7

Source: https://habr.com/ru/post/1016206/


All Articles