1

I ran into a problem, when Mina client on android tried to de-serialized an object, the ClassNotFoundException occured. The stack is shown below:

04-13 01:56:21.521: 
04-13 01:56:21.521: D/RegisterTask(299): Caused by: org.apache.mina.filter.codec.ProtocolDecoderException: java.lang.ClassNotFoundException: com.geoxy.message.agent.user.RegisterResponse (Hexdump: 12 00 00 2A 00 00 00 DA 12 04 00 02 00 00 00 D2 AC ED 00 05 73 72 01 00 2D 63 6F 6D 2E 67 65 6F 78 79 2E 6D 65 73 73 61 67 65 2E 61 67 65 6E 74 2E 75 73 65 72 2E 52 65 67 69 73 74 65 72 52 65 73 70 6F 6E 73 65 78 72 01 00 1D 63 6F 6D 2E 67 65 6F 78 79 2E 63 6F 6D 6D 6F 6E 2E 52 65 73 70 6F 6E 73 65 42 61 73 65 78 72 01 00 1C 63 6F 6D 2E 67 65 6F 78 79 2E 63 6F 6D 6D 6F 6E 2E 4D 65 73 73 61 67 65 42 61 73 65 78 70 12 04 00 02 73 72 01 00 2D 63 6F 6D 2E 67 65 6F 78 79 2E 63 6F 6D 6D 6F 6E 2E 4D 65 73 73 61 67 65 42 61 73 65 24 4D 65 73 73 61 67 65 53 69 67 6E 61 74 75 72 65 78 70 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 00 71 00 7E 00 03 00 70 00 00 00 00 00 00 00 03)

04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:251)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$5(DefaultIoFilterChain.java:429)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:796)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:119)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:426)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:715)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$9(AbstractPollingIoProcessor.java:654)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1141)
04-13 01:56:21.521: D/RegisterTask(299):    at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)

But I don't understand, the missing class "com.geoxy.message.agent.user.RegisterResponse" is actually included in the message.jar, which I have put the message.jar under the project buildpath. (and the server also used the same message.jar to serialize the class.)

And I also have checked the project .classpath, it included the message.jar.

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="gen"/>
    <classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
    <classpathentry kind="lib" path="libs/dumpcatcher.jar"/>
    <classpathentry kind="lib" path="libs/common-0.1.jar"/>
    <classpathentry kind="lib" path="libs/log4j-1.2.16.jar"/>
    <classpathentry kind="lib" path="libs/slf4j-android-1.6.1-RC1.jar"/>
    <classpathentry kind="lib" path="libs/message-0.1.jar"/>    <!---here is it.-->
    <classpathentry kind="lib" path="libs/mina-core-2.0.4.jar"/>
    <classpathentry kind="output" path="bin/classes"/>
</classpath>

Please help, are there any other reasons caused the ClassNotFoundException? Thank you very much. I also put some information in this post: Run (synchronize) mina client on Android, how to resolve ClassNotFoundException

Community
  • 1
  • 1
weifang
  • 21
  • 4

1 Answers1

0

I think in the Message.jar the class you are trying to access ""egisterResponse" extends the activity, In these case you must add these activity in your manifeast file..like below

<activity android:name="com.geoxy.message.agent.user.RegisterResponse" />

Also remember that if any of our external jar has classess that extends Activity then that activity must be declared in our manifeast file too.

Try this might help you.

Or try placeing your jar file in libs folder of your project and then link it up and try.

Shankar Agarwal
  • 34,573
  • 7
  • 66
  • 64
  • Message.jar is not build by android project, it's a java library which was built with maven. so it didn't extend the activity. The Message.jar is used both in android project, and in my server project(running on PC). I also have tried "placeing your jar file in libs folder of your project and then link it up". Thank you. – weifang Apr 13 '12 at 06:16