powered by Jive Software

ava.lang.IllegalStateException: No DNS Resolver active in Smack at org.jivesoftware. smack.util.DNSUtil.resolveDomain(DNSUtil.java:169)

  • Using Smack 4.2.1
    Getting :
java.lang.IllegalStateException: No DNS Resolver active in Smack
                                                               at org.jivesoftware.smack.util.DNSUtil.resolveDomain(DNSUtil.java:169)
                                                               at org.jivesoftware.smack.util.DNSUtil.resolveXMPPServiceDomain(DNSUtil.java:136)

when I call :

            List<HostAddress> myHoosts= DNSUtil.resolveXMPPServiceDomain(mDomain, listHost, ConnectionConfiguration.DnssecMode.disabled);

Is there some way to set the dnsResolver so it is not null when I try to resolve ? Couldn’t find a way to do this in the Doc.

Thanks.

Please also read “How to report an issue”

How do you include Smack into your project?

Standard gradle way in Android Studio if that helps

compile "org.igniterealtime.smack:smack-tcp:$smackVersion"
    compile "org.igniterealtime.smack:smack-experimental:$smackVersion"
    compile("org.igniterealtime.smack:smack-android:$smackVersion") {
        exclude module: 'smack-omemo'
        exclude module: 'smack-omemo-signal'
    }

That is strange. The error you are seeing usually indicates that users either forget to include smack-java7 or smack-android.

smakc-android depends on smack-resolver-minidns, which, if its in your classpath, should be detected by Smack’s initialization routine and set the MiniDNS resolver.

Could you check that you have smack-resolver-minidns in your projects dependencies?

Seems smack-resorver-minidns is in my dependencies.

Couild you check if manually calling MiniDnsResolver.setup fixes the issue for you?

Calling MiniDnsResolver.setup fixes the issue, it resolves the domain now. Thanks for the help by the way.Could you shed some light as to why this is ?

Smack’s initialization routine should setup a resolver if one is available. You should never need to call it manually. It is impossible to tell from a distance why this doesn’t work in your case…

I’ll keep using it this way for the moment, may be it has something to do with how my project is setup, will investigate more when I have more time resources. For now , this issue should be considered resolved I guess.