getMUCUserExtension() execution error

Hi,

I have developped my chat application using Smack with Eclipse and it works perfectly. As a matter of fact, I am trying to export my project in .jar archive but I am facing a strange problem…

I can run my application executing my .class with java -cp /output/smack.jar:/output/smackx.jar MainClass but I cannot run it when I add Smack’'s .class files with my own files. I get this error message:

+java.lang.ClassCastException

at org.jivesoftware.smackx.muc.MultiUserChat.getMUCUserExtension(MultiUserChat.jav a:1895)

at org.jivesoftware.smackx.muc.MultiUserChat.access$600(MultiUserChat.ja va:45)

at org.jivesoftware.smackx.muc.MultiUserChat$8.processPacket(MultiUserCh at.java:2110)

at org.jivesoftware.smack.PacketReader$ListenerWrapper.notifyListener(PacketReader .java:563)

at org.jivesoftware.smack.PacketReader.processListeners(PacketReader.jav a:218)

at org.jivesoftware.smack.PacketReader.access$100(PacketReader.java:42)

at org.jivesoftware.smack.PacketReader$2.run(PacketReader.java:70)+

I am using the smack-dev-2005-03-03 version of Smack and I tried several way to solve the problem:

  • extract .class files from smack.jar and smackx.jar files

  • use ant script outputs

  • recompile from sources

Since I have no idea why I can only run my application with Smack’‘s .jar files and not with Smack’'s .class files, could you give me some help/ideas?

I should precise that the error message always occurs when the application create a MultiUserChat. When I comment MUC creations, the application run properly…

Does someone can help me?

Hey Seb,

Have you modified the Smack classes? If not you may just add the original Smack jar files to the classpath when running your application. From the error that you are having it seems that the problem is that you are not adding the META-INF folder to your new jar file. In the META-INF folder you need to have the smack-config.xml and the smack.providers files.

Regards,

– Gato

Hi Gato,

Ok, the META-INF folder was the source of the error. I was not familiar with .jar files and I did not thought to check the content of this directory… After adding the files you mentioned, I can run my .jar file without any exception thrown

Once again, thanks for being so helpful, (and sorry for being so assisted )

Seb