AnsweredAssumed Answered

Problem with XMPPTCPConnectionConfiguration.Builder setXmppDomain and related method not found

Question asked by James McClure on Apr 4, 2017
Latest reply on Apr 5, 2017 by James McClure

In Smack 4.2.0, I am not able to access the setXmppDomain methods or the setInetAddress method of XMPPTCPConnectionConfiguration.Builder. In the former case, the code compiles correctly but fails on execution with the error:

 

java.lang.NoSuchMethodError: org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration$Builder.setXmppDomain (Ljava/lang/String;)Lorg/jivesoftware/smack/ConnectionConfiguration$Builder;

 

Unfortunately I think this makes it impossible to use a custom configuration with XMPP TCP Connections? I have checked via reflection during execution and indeed the returned builder class does not include the setXmppDomain methods. It seems to be a different class or different version than indicated in the source? Could this be a JAR/packaging problem or problem with Maven/repository?

 

In trying to access the setInetAddress method, I get a different runtime exception (again, compiling is fine):

 

java.lang.NoSuchMethodError: org.jxmpp.util.cache.Cache.lookup(Ljava/lang/Object;)Ljava/lang/Object;

 

My application is deployed as an EAR. This is my Gradle configuration:

 

maven {
   url 'https://oss.sonatype.org/content/repositories/snapshots'

}

 

dependencies {

earlib "org.igniterealtime.smack:smack-java7:4.2.0"
// Optional for XMPPTCPConnection
earlib "org.igniterealtime.smack:smack-tcp:4.2.0"
// Optional for XMPP-IM (RFC 6121) support (Roster, Threaded Chats, …)
earlib "org.igniterealtime.smack:smack-im:4.2.0"
// Optional for XMPP extensions support

earlib "org.igniterealtime.smack:smack-extensions:4.2.0"

}

 

(Side note: I have no idea why this pasted as a table?)

 

This is my code:

 

        // Create our configuration
        XMPPTCPConnectionConfiguration.Builder configurationBuilder = XMPPTCPConnectionConfiguration.builder();
      
        configurationBuilder.setXmppDomain(messagingServerHost); // <------- Fails with method not found
        configurationBuilder.setUsernameAndPassword(userName, password);
       

configurationBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabl ed); // XMPP server is on same host as app

// etc...

      
        // Create configuration
        XMPPTCPConnectionConfiguration conf = configurationBuilder.build();

 

 

The messagingServerHost is a string with the domain.

 

I have also tried using a bare JID domain, etc., but none of the methods seem to allow me to set the address of the XMPP server, which makes it seemingly impossible to use the custom configuration? Any help is appreciated, thanks!!

Outcomes