powered by Jive Software

MultiUserChatManager bad type operand stack

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.(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

upgraded to 4.2.0 and all the way up to the latest…

Didn’t realize that it chose a release candidate now that i’m looking at the actual version of smack.

I see a massive amount of red now that I upgraded versions.

i’ll make a copy of my code (maybe someone has an idea on the above) but in the meantime I have some rewriting to do. but otherwise everything else works.

ok, i’m off the release candidate. Still having the same issue

smack

3.2.1

org.igniterealtime.smack

smack-core

4.2.0

org.igniterealtime.smack

smack-tcp

4.2.0

org.igniterealtime.smack

smackx

3.2.1

org.igniterealtime.smack

smack-repl

4.2.0

The cause of your problem is that you’re mixing libraries from two different (and incompatible) versions of Smack. Your pom.xml snippet contains references to both 3.2.1 as well as 4.2.0. Only use one version (preferably the one that’s most up-to-date).

Thanks!!

Also found here Smack 4.1 Readme and Upgrade Guide · igniterealtime/Smack Wiki · GitHub

org.igniterealtime.smack

smack

3.2.1

org.igniterealtime.smack

smack-core

4.2.1-beta1

org.igniterealtime.smack

smack-tcp

4.2.1-beta1

org.igniterealtime.smack

smackx

3.2.1

org.igniterealtime.smack

smack-repl

4.2.1-beta1