XMPPError: item-not-found - cancel

XMPPError: item-not-found - cancel

我在 android 中使用 xampp 和 Openfire 进行群聊。我在下面附上了用于加入聊天室的代码,但我收到一条错误消息 XMPPError: item-not-found - cancel.

尽管我尝试了一些相关问题 none,但这些答案对我有所帮助。因此,如果有人可以帮助我,那就太好了。

public void joinChatRoom(String userName, String roomName) {
    try {
        Log.d("xmpp: ", "Service Name: " + connection.getServiceName());
    } catch (Exception e) {
        e.printStackTrace();
        Log.d("xmpp: ", "service name error: "+e.getMessage());
    }
    manager = MultiUserChatManager.getInstanceFor(connection);
    multiUserChat = manager.getMultiUserChat(roomName+ "@" +CHAT_ROOM_SERVICE_NAME + CHAT_SERVER_SERVICE_NAME);
    try {
        multiUserChat.join(userName);
    } catch (SmackException.NoResponseException e) {
        e.printStackTrace();
        Log.d("xmpp: ", "Chat room join Error: " + e.getMessage());
        sendBroadCast("joinerror", e.getMessage());
    } catch (XMPPException.XMPPErrorException e) {
        e.printStackTrace();
        Log.d("xmpp: ", "Chat room join Error: " + e.getMessage());
        sendBroadCast("joinerror", e.getMessage());
    } catch (SmackException.NotConnectedException e) {
        e.printStackTrace();
        Log.d("xmpp: ", "Chat room join Error: " + e.getMessage());
        sendBroadCast("joinerror", e.getMessage());
    }

    // if user joined successfully
    if (multiUserChat.isJoined()) {
        Log.d("xmpp: ", "user has Joined in the chat room");
        sendBroadCast("join", "done");
        //call method to configure room
        configRoom(roomName);

        // get Roster
        getBuddies();
        //get user info
        getUserInfo(userName);

     }
}

我找到了答案。 我刚刚更新了聊天对象。之前导入的class是错误的。 现在已使用以下行更正。

org.jivesoftware.smack.chat.Chat