powered by Jive Software

Smack java.lang.ClassCastException


#1

Those exception occured on Smack 4.1.8 What should i do ?@Flow

Sep 13, 2016 6:25:20 PM org.jivesoftware.smack.roster.Roster$PresencePacketListener processPacket
WARNING: Roster not loaded while processing presence stanza
Sep 13, 2016 6:25:26 PM org.jivesoftware.smack.AbstractXMPPConnection$3 run
SEVERE: Exception in async packet listener
java.lang.ClassCastException: org.jivesoftware.smack.packet.DefaultExtensionElement cannot be cast to org.jivesoftware.smackx.workgroup.packet.QueueUpdate
  at org.jivesoftware.smackx.workgroup.user.Workgroup.handlePacket(Workgroup.java:506)
  at org.jivesoftware.smackx.workgroup.user.Workgroup.access$300(Workgroup.java:74)
  at org.jivesoftware.smackx.workgroup.user.Workgroup$3.processPacket(Workgroup.java:147)
  at org.jivesoftware.smack.AbstractXMPPConnection$3.run(AbstractXMPPConnection.java:1105)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745) Sep 13, 2016 6:25:31 PM org.jivesoftware.smack.AbstractXMPPConnection$3 run
SEVERE: Exception in async packet listener
java.lang.ClassCastException: org.jivesoftware.smack.packet.DefaultExtensionElement cannot be cast to org.jivesoftware.smackx.workgroup.packet.SessionID
  at org.jivesoftware.smackx.workgroup.user.Workgroup.handlePacket(Workgroup.java:526)
  at org.jivesoftware.smackx.workgroup.user.Workgroup.access$300(Workgroup.java:74)
  at org.jivesoftware.smackx.workgroup.user.Workgroup$3.processPacket(Workgroup.java:147)
  at org.jivesoftware.smack.AbstractXMPPConnection$3.run(AbstractXMPPConnection.java:1105)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745) Sep 13, 2016 6:25:44 PM org.jivesoftware.smack.AbstractXMPPConnection$3 run
SEVERE: Exception in async packet listener
java.lang.ClassCastException: org.jivesoftware.smack.packet.DefaultExtensionElement cannot be cast to org.jivesoftware.smackx.workgroup.packet.SessionID
  at org.jivesoftware.smackx.workgroup.user.Workgroup.handlePacket(Workgroup.java:526)
  at org.jivesoftware.smackx.workgroup.user.Workgroup.access$300(Workgroup.java:74)
  at org.jivesoftware.smackx.workgroup.user.Workgroup$3.processPacket(Workgroup.java:147)
  at org.jivesoftware.smack.AbstractXMPPConnection$3.run(AbstractXMPPConnection.java:1105)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  at java.lang.Thread.run(Thread.java:745)

#2

I added those two provider and solved problems

ProviderManager.addExtensionProvider(SessionID.ELEMENT_NAME, SessionID.NAMESPACE,new SessionID.Provider());
ProviderManager.addExtensionProvider(QueueUpdate.ELEMENT_NAME, QueueUpdate.NAMESPACE,new QueueUpdate.Provider());

#3

I am facing the same error using Smack 4.1.9 . I tried adding the two providers and it is still not working.Please help me out.Thank you.