2

I'm new to flexjson.

I tried the following java code for my test: "FlexjsonTest.zip".

The result of running the program is in "Protocol.txt".

I ran the code from the command line:

javac FlexjsonTest.java
java Flexjson

I use flexjson 2.1 .

Using Java 6 or Java 7 doesn't make any difference.

The result is always:

Exception in thread "main" flexjson.JSONException: [ _address ]:  Could not load Address
at flexjson.ObjectBinder.findClassInMap(ObjectBinder.java:235)
at flexjson.ObjectBinder.findClassName(ObjectBinder.java:202)
at flexjson.ObjectBinder.bind(ObjectBinder.java:83)
at flexjson.ObjectBinder.bindIntoObject(ObjectBinder.java:139)
at flexjson.factories.ClassLocatorObjectFactory.instantiate(ClassLocatorObjectFactory.java:38)
at flexjson.ObjectBinder.bind(ObjectBinder.java:86)
at flexjson.ObjectBinder.bind(ObjectBinder.java:65)
at flexjson.JSONDeserializer.deserialize(JSONDeserializer.java:158)
at FlexjsonTest.<init>(FlexjsonTest.java:22)
at FlexjsonTest.main(FlexjsonTest.java:32)
Caused by: java.lang.ClassNotFoundException: Address
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:188)
at flexjson.ObjectBinder.findClassInMap(ObjectBinder.java:230)
... 9 more

So, what am I doing wrong? igel

AJMansfield
  • 4,039
  • 3
  • 29
  • 50

1 Answers1

0

it seems that you're trying to deserialize a JSON into an object called Address but the class Address seems not to be in your classpath

at flexjson.JSONDeserializer.deserialize(JSONDeserializer.java:158)
at FlexjsonTest.<init>(FlexjsonTest.java:22)
at FlexjsonTest.main(FlexjsonTest.java:32)
Caused by: java.lang.ClassNotFoundException: Address

also, you should post the code that actually throws this stacktrace in your question

Leo
  • 6,480
  • 4
  • 37
  • 52
  • 1
    I´ve got the same error after reading an object twice from the same bytearray. First time it works, second time I´ve got a ClassNotFoundException. So it looks stranger than the classpath thing. By the way, It happens to me in android 4.4 but not in 5.1 – eduyayo Jun 25 '15 at 16:37