powered by Jive Software

Error while joining chat room using smack


#1

I am using smack version 4.3.0.

When i join room it throws exception:-

No response received within reply timeout. Timeout was 10000ms (~10s). Waited for response using: IQReplyFilter: iqAndIdFilter (AndFilter: (OrFilter: (IQTypeFilter: type=error, IQTypeFilter: type=result), StanzaIdFilter: id=K2Wt4-5)), : fromFilter (OrFilter: (FromMatchesFilter (full): shine.xyz.com)).

Following code to get connection:-

public AbstractXMPPConnection login(String userName, String password){
AbstractXMPPConnection connection = null;
try{
XMPPTCPConnectionConfiguration.Builder configBuilder = XMPPTCPConnectionConfiguration.builder();
configBuilder.setUsernameAndPassword(userName, password);
configBuilder.setHost(host);
configBuilder.setXmppDomain(domain);
configBuilder.setPort(port);
configBuilder.setSecurityMode(ConnectionConfiguration.SecurityMode.disabled);
configBuilder.setCompressionEnabled(false);
//configBuilder.setDebuggerEnabled(true);
configBuilder.setSendPresence(true);
connection = new XMPPTCPConnection(configBuilder.build());
connection.addAsyncStanzaListener(new StanzaListener() {
@Override
public void processStanza(Stanza packet) throws SmackException.NotConnectedException, InterruptedException, SmackException.NotLoggedInException {
logger.info(“processStanza”);
}
}, new PacketTypeFilter(Message.class));
connection.setReplyTimeout(10 * 1000);
connection.connect();
connection.login();
logger.info(“Connected …”);
}
catch(Exception e){
logger.error(e.getMessage());
e.printStackTrace();
}
return connection;
}

Code to join room which throws exeption:-

MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);
String mucJid = roomName + “@” + “conference” + “.” + domain;
MultiUserChat muc2 = manager.getMultiUserChat(JidCreate.entityBareFrom(mucJid));
Presence presence = new Presence(Presence.Type.available);
connection.sendStanza(presence);
muc2.join(Resourcepart.from(userName));

Please help me on this.

Thanks
Mayur


#2

Please use the latest released version of Smack and always include the stacktrace of the exception.

Also have a look at https://github.com/igniterealtime/Smack/wiki/How-to-ask-for-help,-report-an-issue-and-possible-solve-the-problem-yourself