powered by Jive Software

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


#1
  • 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”


#2

How do you include Smack into your project?


#3

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'
    }

#4

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?


#5

Seems smack-resorver-minidns is in my dependencies.


#6

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


#7

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 ?


#8

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…


#9

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.