-
Notifications
You must be signed in to change notification settings - Fork 294
Open
Description
I'm using the Stanford Parser with pyjnius. Using the autoclass
function of pyjnius, I can use the java classes from the parser. However, when I try to deserialize something that uses those classes, I get a ClassNotFoundException
. How could I ensure that the jvm has access to the the class when deserializing (calling readObject
)?
This works fine
ArrayList = autoclass('java.util.ArrayList')
ScoredObject = autoclass('edu.stanford.nlp.util.ScoredObject')
sensTrees = ArrayList()
sensTrees.add(ScoredObject(ArrayList(), 5))
outFile = FileOutputStream('javaParses.ser')
oos = ObjectOutputStream(outFile)
oos.writeObject(sensTrees)
But this throws the error below
inFile = FileInputStream('javaParses.ser')
ois = ObjectInputStream(inFile)
Docs = ois.readObject() // this line throws the error
Error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\we890\seniorThesis\parseDocs.py", line 75, in test
Docs = ois.readObject()
File "jnius\jnius_export_class.pxi", line 766, in jnius.JavaMethod.__call__
File "jnius\jnius_export_class.pxi", line 843, in jnius.JavaMethod.call_method
File "jnius\jnius_utils.pxi", line 91, in jnius.check_exception
jnius.JavaException: JVM exception occurred: edu.stanford.nlp.util.ScoredObject
Older Error (I think from a different jdk and pyjinius version)
java.lang.ClassNotFoundException: edu.stanford.nlp.util.ScoredObject
tueda
Metadata
Metadata
Assignees
Labels
No labels