olupotd / asmack

Automatically exported from code.google.com/p/asmack
Other
0 stars 0 forks source link

ClassCastException FIX #59

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using any IQ class ie pubsub ect
2. Alot of other Smackx classes

What is the expected output? What do you see instead?
Working

What version of the product are you using? On what operating system?
3.1 or 3.2

Please provide any additional information below.
This is a FIX because im tired of ppl having issues with it and i dont know how 
to submit a fix :).

**********************************************************************
Attached is the ProviderManager.java that goes in the 
org.jivesoftware.smack.providers folder. Replace it with the following. Next is 
the smack.providers file. All of the class cast exception errors are caused by 
smack not being able to load this file. What this patch does is sets the 
ProviderManager.java to look for the smack.providers in a specific location 
that YOU designate. Once you have the new ProviderManager.java compiled into 
your jar you then need to put the smack.providers file somewhere on you android 
device(preferably where it cant be deleted). I have it extracted to my apps 
data folder at run time. Then you need to do the following to tell smack where 
to look for the file.

System.setProperty("PROPERTY_SMACK_PROVIDERS", 
"/data/data/jug6ernaut.test.xmpp/assets/smack.providers");

do not change the "PROPERTY_SMACK_PROVIDERS", you change the second parameter 
to you location for the smack.provider file. Include that line of code in you 
main activites onCreate();. This is not the best solution in the world, but it 
does work.

Original issue reported on code.google.com by Jug6ern...@gmail.com on 13 Jun 2011 at 1:58

Attachments:

GoogleCodeExporter commented 9 years ago
i don not understand 
i am facing class cast exception when using muc.create (MultiUserChat)

??? what shoud i do please explain further 

Original comment by shecko...@gmail.com on 25 Jul 2011 at 2:24

GoogleCodeExporter commented 9 years ago
shecko...

You need to first replace the ProviderManager.java in your asmack source with 
the one i provided. This ProviderManager.java is modified to load 
smack.providers file from a specific location rather then from within the jar 
file. You will need to place smack.providers somewhere on the device, i 
personally put it in a zip file /assets of my apk then extract it to my 
programs data dir. Then in your main activity you will need to tell the 
ProviderManager.java where to look for the smack.providers file. I do this by 
setting a system property like this.

System.setProperty("PROPERTY_SMACK_PROVIDERS", 
"/data/data/jug6ernaut.test.xmpp/assets/smack.providers");

Here you will want to change the path to w/e path u want. For testing u could 
just put ur smack.providers on ur sdcard then put the path as 
"/sdcard/smack.providers".

Original comment by Jug6ern...@gmail.com on 25 Jul 2011 at 6:21

GoogleCodeExporter commented 9 years ago
also Android does not include MXP1, a required package for this replacement 
ProviderManager.java.  you will need to include the jar in your project.  you 
can find it here:

http://www.extreme.indiana.edu/xgws/xsoap/xpp/mxp1/

Original comment by moonligh...@gmail.com on 11 Jul 2012 at 2:55

GoogleCodeExporter commented 9 years ago
How can i build the source of amack files after changing the 
ProviderManager.java ? 

Original comment by logicat...@gmail.com on 29 Aug 2012 at 6:09

GoogleCodeExporter commented 9 years ago
I am getting following errors at run time after i modify ProviderManager.java 
and set path of smack.provider can anyone help  me how can i get rid off this 
errors

08-30 12:02:12.234: W/System.err(2418): java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.socks5.provider.BytestreamsProvider
08-30 12:02:12.234: W/System.err(2418):     at java.lang.Class.classForName(Native 
Method)
08-30 12:02:12.234: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:234)
08-30 12:02:12.234: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:181)
08-30 12:02:12.244: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.loadProviders(ProviderManager.ja
va:195)
08-30 12:02:12.244: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.initialize(ProviderManager.java:
306)
08-30 12:02:12.244: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.<init>(ProviderManager.java:486)
08-30 12:02:12.244: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.getInstance(ProviderManager.java
:141)
08-30 12:02:12.244: W/System.err(2418):     at 
org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:302
)
08-30 12:02:12.244: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:230)
08-30 12:02:12.255: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:221)
08-30 12:02:12.255: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
08-30 12:02:12.255: W/System.err(2418): Caused by: 
java.lang.NoClassDefFoundError: 
org.jivesoftware.smackx.bytestreams.socks5.provider.BytestreamsProvider
08-30 12:02:12.255: W/System.err(2418):     ... 11 more
08-30 12:02:12.264: W/System.err(2418): Caused by: 
java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.socks5.provider.BytestreamsProvider in 
loader dalvik.system.PathClassLoader[/data/app/com.bcl-1.apk]
08-30 12:02:12.274: W/System.err(2418):     at 
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
08-30 12:02:12.274: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
08-30 12:02:12.274: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-30 12:02:12.274: W/System.err(2418):     ... 11 more
08-30 12:02:12.285: W/System.err(2418): java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.ibb.provider.OpenIQProvider
08-30 12:02:12.285: W/System.err(2418):     at java.lang.Class.classForName(Native 
Method)
08-30 12:02:12.285: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:234)
08-30 12:02:12.285: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:181)
08-30 12:02:12.294: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.loadProviders(ProviderManager.ja
va:195)
08-30 12:02:12.294: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.initialize(ProviderManager.java:
306)
08-30 12:02:12.304: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.<init>(ProviderManager.java:486)
08-30 12:02:12.304: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.getInstance(ProviderManager.java
:141)
08-30 12:02:12.304: W/System.err(2418):     at 
org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:302
)
08-30 12:02:12.304: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:230)
08-30 12:02:12.304: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:221)
08-30 12:02:12.304: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
08-30 12:02:12.314: W/System.err(2418): Caused by: 
java.lang.NoClassDefFoundError: 
org.jivesoftware.smackx.bytestreams.ibb.provider.OpenIQProvider
08-30 12:02:12.314: W/System.err(2418):     ... 11 more
08-30 12:02:12.324: W/System.err(2418): Caused by: 
java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.ibb.provider.OpenIQProvider in loader 
dalvik.system.PathClassLoader[/data/app/com.bcl-1.apk]
08-30 12:02:12.324: W/System.err(2418):     at 
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
08-30 12:02:12.324: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
08-30 12:02:12.324: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-30 12:02:12.324: W/System.err(2418):     ... 11 more
08-30 12:02:12.333: W/System.err(2418): java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.ibb.provider.DataPacketProvider
08-30 12:02:12.333: W/System.err(2418):     at java.lang.Class.classForName(Native 
Method)
08-30 12:02:12.333: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:234)
08-30 12:02:12.344: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:181)
08-30 12:02:12.344: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.loadProviders(ProviderManager.ja
va:195)
08-30 12:02:12.344: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.initialize(ProviderManager.java:
306)
08-30 12:02:12.344: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.<init>(ProviderManager.java:486)
08-30 12:02:12.344: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.getInstance(ProviderManager.java
:141)
08-30 12:02:12.358: W/System.err(2418):     at 
org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:302
)
08-30 12:02:12.358: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:230)
08-30 12:02:12.358: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:221)
08-30 12:02:12.358: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
08-30 12:02:12.363: W/System.err(2418): Caused by: 
java.lang.NoClassDefFoundError: 
org.jivesoftware.smackx.bytestreams.ibb.provider.DataPacketProvider
08-30 12:02:12.363: W/System.err(2418):     ... 11 more
08-30 12:02:12.363: W/System.err(2418): Caused by: 
java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.ibb.provider.DataPacketProvider in loader 
dalvik.system.PathClassLoader[/data/app/com.bcl-1.apk]
08-30 12:02:12.363: W/System.err(2418):     at 
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
08-30 12:02:12.375: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
08-30 12:02:12.375: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-30 12:02:12.375: W/System.err(2418):     ... 11 more
08-30 12:02:12.375: W/System.err(2418): java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.ibb.provider.CloseIQProvider
08-30 12:02:12.384: W/System.err(2418):     at java.lang.Class.classForName(Native 
Method)
08-30 12:02:12.384: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:234)
08-30 12:02:12.384: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:181)
08-30 12:02:12.384: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.loadProviders(ProviderManager.ja
va:195)
08-30 12:02:12.384: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.initialize(ProviderManager.java:
306)
08-30 12:02:12.384: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.<init>(ProviderManager.java:486)
08-30 12:02:12.395: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.getInstance(ProviderManager.java
:141)
08-30 12:02:12.395: W/System.err(2418):     at 
org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:302
)
08-30 12:02:12.395: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:230)
08-30 12:02:12.395: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:221)
08-30 12:02:12.395: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
08-30 12:02:12.395: W/System.err(2418): Caused by: 
java.lang.NoClassDefFoundError: 
org.jivesoftware.smackx.bytestreams.ibb.provider.CloseIQProvider
08-30 12:02:12.395: W/System.err(2418):     ... 11 more
08-30 12:02:12.395: W/System.err(2418): Caused by: 
java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.ibb.provider.CloseIQProvider in loader 
dalvik.system.PathClassLoader[/data/app/com.bcl-1.apk]
08-30 12:02:12.405: W/System.err(2418):     at 
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
08-30 12:02:12.405: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
08-30 12:02:12.405: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-30 12:02:12.413: W/System.err(2418):     ... 11 more
08-30 12:02:12.425: W/System.err(2418): java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.ibb.provider.DataPacketProvider
08-30 12:02:12.425: W/System.err(2418):     at java.lang.Class.classForName(Native 
Method)
08-30 12:02:12.425: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:234)
08-30 12:02:12.434: W/System.err(2418):     at 
java.lang.Class.forName(Class.java:181)
08-30 12:02:12.434: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.loadProviders(ProviderManager.ja
va:229)
08-30 12:02:12.434: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.initialize(ProviderManager.java:
306)
08-30 12:02:12.434: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.<init>(ProviderManager.java:486)
08-30 12:02:12.434: W/System.err(2418):     at 
org.jivesoftware.smack.provider.ProviderManager.getInstance(ProviderManager.java
:141)
08-30 12:02:12.434: W/System.err(2418):     at 
org.jivesoftware.smack.util.PacketParserUtils.parseIQ(PacketParserUtils.java:302
)
08-30 12:02:12.457: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:230)
08-30 12:02:12.457: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader.access$1(PacketReader.java:221)
08-30 12:02:12.457: W/System.err(2418):     at 
org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)
08-30 12:02:12.457: W/System.err(2418): Caused by: 
java.lang.NoClassDefFoundError: 
org.jivesoftware.smackx.bytestreams.ibb.provider.DataPacketProvider
08-30 12:02:12.457: W/System.err(2418):     ... 11 more
08-30 12:02:12.464: W/System.err(2418): Caused by: 
java.lang.ClassNotFoundException: 
org.jivesoftware.smackx.bytestreams.ibb.provider.DataPacketProvider in loader 
dalvik.system.PathClassLoader[/data/app/com.bcl-1.apk]
08-30 12:02:12.464: W/System.err(2418):     at 
dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
08-30 12:02:12.464: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:551)
08-30 12:02:12.464: W/System.err(2418):     at 
java.lang.ClassLoader.loadClass(ClassLoader.java:511)
08-30 12:02:12.474: W/System.err(2418):     ... 11 more

Original comment by logicat...@gmail.com on 30 Aug 2012 at 6:56