powered by Jive Software

Cannot cast smack.util.PacketParserUtils$2 to smackx.packet.MUCAdmin

I’m trying to create a CraftBukkit (a Minecraft server implementation) plugin, which would allow people to see chat from the game on an XAMPP server and vice-versa.

I’ve got the code, downloaded latest smack, downloaded xpp3 from http://www.extreme.indiana.edu/dist/java-repository/xpp3/distributions and compiled everything together.

This code, however, generates an error:

chatRoom.join(“nickname”, “password”, history, SmackConfiguration.getPacketReplyTimeout());

for (Occupant occupant : chatRoom.getParticipants()) {

// error occures at the next line

participantNicks.put(occupant.getJid(), occupant.getNick());

}

This question implies something about META-INF in the Jar file presumably, but that’s not my case here.

Any help would be appreciated

How do you know that isn’t the case?

This error is caused when no IQProvider or PacketExtensionProvider can be found for the specific stanza in question. If there is no provider, then the stanza will be parsed into a default IQ packet or PacketExtension. This will then lead to the class cast exception when the returned IQ or extension is cast to a specific class, like MUCAdmin in your case.

Certain environments, like Android for instance, will not include the smack.providers file in the META-INF directory, thus all providers have to be set in code for it to work.