Using the attached SerialTest class, a ClassNotFoundException is raised
when ObjectInputStream.readObject is called directly to deserialize a
custom class instance. However, the method works fine when called from
Java code.
There is no problem deserializing a standard class instance, e.g. a
java.util.HashMap instance.
Example run:
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)]
on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> from jpype import *
>>> startJVM(getDefaultJVMPath(), "-Djava.class.path=.")
>>> SerialTest = JClass("SerialTest")
>>> SerialTest(5,9).testSerial()
>>> bytes = SerialTest(6,10).serializeMe()
>>> test = SerialTest().deserializeMe(bytes)
>>> test.numOne
6
>>> test.numTwo
10
>>> bais = java.io.ByteArrayInputStream(bytes)
>>> ois = java.io.ObjectInputStream(bais)
>>> test2 = ois.readObject()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
jpype._jexception.ExceptionPyRaisable: java.lang.ClassNotFoundException:
SerialTest
Nobody/Anonymous ( nobody ) - 2007-09-21 18:40
5
Open
None
Steve Menard
jpype-win32
Version 0.5
Public
|
Date: 2007-10-15 19:36
|
| Filename | Description | Download |
|---|---|---|
| SerialTest.java | SerialTest class | Download |
| Field | Old Value | Date | By |
|---|---|---|---|
| File Added | 246642: SerialTest.java | 2007-09-21 18:40 | nobody |
Copyright © 2010 Geeknet, Inc. All rights reserved. Terms of Use