AnsweredAssumed Answered

MultiUserChatManager  bad type operand stack

Question asked by jon on Jul 22, 2017
Latest reply on Jul 23, 2017 by jon

I'm trying to get a jabber bot up and going... everything is going pretty well.

However, i skipped over it earlier but when i try to create a MultiUserChatManager so it can get the listener setup and accept the invites.

 

USING:

-- Maven decided to use Smack-core-4.2.0-rc2.jar

I feel like if I downgrade versions everything is going to break   because a lot of stuff has changed.

 

Creating the connection manager

Exception in thread "main" java.lang.VerifyError: Bad type on operand stack

Exception Details:

  Location:

    org/jivesoftware/smackx/muc/MultiUserChatManager.decline(Lorg/jxmpp/jid/EntityB areJid;Lorg/jxmpp/jid/EntityBareJid;Ljava/lang/String;)V @50: invokeinterface

  Reason:

    Type 'org/jivesoftware/smack/packet/Message' (current frame, stack[1]) is not assignable to 'org/jivesoftware/smack/packet/Stanza'

  Current Frame:

    bci: @50

    flags: { }

    locals: { 'org/jivesoftware/smackx/muc/MultiUserChatManager', 'org/jxmpp/jid/EntityBareJid', 'org/jxmpp/jid/EntityBareJid', 'java/lang/String', 'org/jivesoftware/smack/packet/Message', 'org/jivesoftware/smackx/muc/packet/MUCUser', 'org/jivesoftware/smackx/muc/packet/MUCUser$Decline' }

    stack: { 'org/jivesoftware/smack/XMPPConnection', 'org/jivesoftware/smack/packet/Message' }

  Bytecode:

    0x0000000: bb00 4459 2bb7 0045 3a04 bb00 4659 b700

    0x0000010: 473a 05bb 0048 592d 2cb7 0049 3a06 1905

    0x0000020: 1906 b600 4a19 0419 05b6 004b 2ab6 0004

    0x0000030: 1904 b900 4c02 00b1                   

 

 

at com.mycompany.jabber.JabberController.createInviteListener(JabberController.jav a:159)

at com.mycompany.jabber.JabberController.<init>(JabberController.java:104)

at main.main(main.java:42)

message: test@test.jabber.org:: This room is not anonymous.

 

Here's the code

It's currently XMPPConnection connection connected already, and the connection is global variable XMPPConnection connection

 

import static java.lang.System.exit;

import java.util.Collection;

import java.util.List;

import org.jivesoftware.smack.Chat;

import org.jivesoftware.smack.ChatManager;

import org.jivesoftware.smack.ChatManagerListener;

import org.jivesoftware.smack.Connection;

import org.jivesoftware.smack.ConnectionConfiguration;

import org.jivesoftware.smack.MessageListener;

import org.jivesoftware.smack.PacketListener;

import org.jivesoftware.smack.XMPPConnection;

import org.jivesoftware.smack.packet.Message;

import org.jivesoftware.smack.packet.Packet;

import org.jivesoftware.smack.packet.Presence;

import org.jivesoftware.smackx.Form;

import org.jivesoftware.smackx.muc.InvitationListener;

import org.jivesoftware.smackx.muc.MultiUserChat;

import org.jivesoftware.smackx.muc.MultiUserChatManager;

import org.jxmpp.jid.EntityBareJid;

import org.jxmpp.jid.EntityFullJid;

import org.jxmpp.jid.impl.JidCreate;

import org.jxmpp.jid.parts.Resourcepart;

 

    
public void createInviteListener() {
        
        //create the manager   
        System.out.println("Creating the connection manager");  //we get to this line
     MultiUserChatManager manager = MultiUserChatManager.getInstanceFor(connection);  //errors on this line
       
         System.out.println("Creating the invitation listener");  //we never make it here 
               manager.addInvitationListener(new InvitationListener() {
           @Override
           public void invitationReceived(Connection conn, String room, String inviter, String reason, String password, Message message) {
             
               System.out.println("Invitation recieved; Room: " + room
            + "\n" + "Invitation recieved; reason: " + reason
            + "\n" + "Invitation received; password: " + password
            + "\n" + "invitation received; message" + message);
               //so we need to make a call to our array list of chat rooms and join the room 
               
              
               
               MultiUserChat mucinvite = new MultiUserChat(conn, room);
               
               
              chats.add(new chatrooms(mucinvite,global));
               
           }
       });
        
        
        
    }
    

 

Also, my function for creating the ChatListener Works.

 

So far though, my application can

Connect,

login,

Create the chatListener.

create a dummy room,

invite a couple of users to the dummy room,

setup the multiuserchat listener to hold the room open and post the results to the console

then it tries to goto the above and fails.

 

hopefully I gave enough information

Outcomes