Java.lang.NoSuchMethodError: org.jxmpp.jid.impl.JidCreate.fullFrom(Smack 4.3.0)

Hello,
i would like to build a small xmpp muc chatbot with smack, but I cant make it work due to unknown (at least for me) errors and missing dependencies.

So my code is quite simple at the moment. It should just connect to the xmpp server, login and join a muc.
It looks like this.

package cloudinc.xeniajabber;

import org.jivesoftware.smack.*;
import org.jivesoftware.smack.tcp.*;
import org.jivesoftware.smackx.muc.MultiUserChat;
import org.jivesoftware.smackx.muc.MultiUserChatManager;
import org.jxmpp.jid.EntityBareJid;
import org.jxmpp.jid.impl.JidCreate;
import org.jxmpp.jid.parts.Resourcepart;

public class XMPPNET {

    AbstractXMPPConnection connection;

    public XMPPNET(String user, String pass, String domain, String host, String room, int port){

        try{
            // Create a connection to the jabber.org server on a specific port.
            XMPPTCPConnectionConfiguration config = XMPPTCPConnectionConfiguration.builder()
                    .setUsernameAndPassword(user, pass)
                    .setXmppDomain(domain)
                    .setHost(host)
                    .setPort(port)
                    .setHostnameVerifier((hostname, session) -> true)
                    .build();
            connection = new XMPPTCPConnection(config);
            connection.connect();
            connection.login();
            joinchatroom(room, host);
        }catch(Exception e){
            System.err.println(e);
        }

    }

    public void joinchatroom(String room, String host){
        try{
            EntityBareJid mucJid = JidCreate.entityBareFrom(room+"@conference"+host);
            Resourcepart nickname = Resourcepart.from("test");
            MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
            MultiUserChat muc = manager.getMultiUserChat(mucJid);
            muc.join(nickname);
        }catch(Exception e){
            System.err.println(e);
        }
    }
    
}

According to the instructions i read, this should do the job, But it just gives me an error:

Exception in thread "main" java.lang.NoSuchMethodError: org.jxmpp.jid.impl.JidCreate.fullFrom(Lorg/jxmpp/jid/EntityBareJid;Lorg/jxmpp/jid/parts/Resourcepart;)Lorg/jxmpp/jid/EntityFullJid;
	at org.jivesoftware.smackx.muc.MucEnterConfiguration.getJoinPresence(MucEnterConfiguration.java:72)
	at org.jivesoftware.smackx.muc.MultiUserChat.enter(MultiUserChat.java:340)
	at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:740)
	at org.jivesoftware.smackx.muc.MultiUserChat.join(MultiUserChat.java:631)
	at cloudinc.xeniajabber.XMPPNET.joinchatroom(XMPPNET.java:42)
	at cloudinc.xeniajabber.XMPPNET.<init>(XMPPNET.java:29)
	at cloudinc.xeniajabber.XeniaJabber.main(XeniaJabber.java:16)

It would be great if someone could help me to make it work.

I recommend to use Smack with a build system that is able to handle Maven dependencies. Those systems typically allow you to specify the dependencies and will automatically resolve all transitive dependencies. Those are the ones giving you a hard time right now and the reason why you should not use the Smack jar files directly.

Please also read Smack’s README.

1 Like