Smack-tcp 4.0.5 vs smack-tcp 4.1 while connecting with openfire

smack 4.0.5 code


ConnectionConfiguration configuration = new ConnectionConfiguration(“127.0.0.1”, 5222);

configuration.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);

XMPPTCPConnection xmpptcpconnection = new XMPPTCPConnection(configuration);

xmpptcpconnection.connect();

xmpptcpconnection.login(“admin”, “admin”, “smack”);

Presence presence = new Presence(Presence.Type.available);

xmpptcpconnection.sendPacket(presence);

…working fine

smack 4.1.0-beta2


XMPPTCPConnectionConfiguration.Builder conf = XMPPTCPConnectionConfiguration.builder();

conf.setSecurityMode(SecurityMode.disabled);

conf.setServiceName(“127.0.0.1”);

conf.setHost(“127.0.0.1”);

conf.setPort(5222);

conf.setSendPresence(false);

conf.setDebuggerEnabled(true);

XMPPTCPConnection connection = new XMPPTCPConnection(conf.build());

connection.setPacketReplyTimeout(10000);

connection.connect();

connection.login(“admin”, “admin”, “smack”);

…not working and not connecting at all

is there anything we should do additionally in openfire with smack 4.1

Try to add this:

conf.setUsernameAndPassword(username + "@yourdomain.com", password);

And this:

connection.login(); (instead of connection.login(“admin”, “admin”, “smack”);

conf.setServiceName(“127.0.0.1”);//this method should be your server name,and in my case it is my ccomputer name

it seems I missed some JAR files, I am not sure, now it is working as it is