Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalidClassException : class invalid for deserialization
    primarykey
    data
    text
    <p>I am using SSA parser library in my project. When I invoke main method of one of it's class using command prompt it works fine on my machine. </p> <p>I execute following command from command prompt :</p> <pre><code>java -Xmx800M -cp %1 edu.stanford.nlp.parser.lexparser.LexicalizedParser -retainTMPSubcategories -outputFormat "penn,typedDependenciesCollapsed" englishPCFG.ser.gz %2 </code></pre> <p>But when I tried to use the same class in my java program, I am getting <code>Caused by: java.io.InvalidClassException: edu.stanford.nlp.stats.Counter; edu.stanford.nlp.stats.Counter; class invalid for deserialization</code> exception. </p> <p>Following line throws error :</p> <pre><code>LexicalizedParser _parser = new LexicalizedParser("C:\englishPCFG.ser.gz"); </code></pre> <p>This <strong>englishPCFG.ser.gz</strong> file contains some classes or information which gets loaded when creating object of type <code>LexicalizedParser</code>. </p> <p>Following is the stacktrace :</p> <pre><code>Loading parser from serialized file C:\englishPCFG.ser.gz ... Exception in thread "main" java.lang.RuntimeException: Invalid class in file: C:\englishPCFG.ser.gz at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserDataFromSerializedFile(LexicalizedParser.java:822) at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserDataFromFile(LexicalizedParser.java:603) at edu.stanford.nlp.parser.lexparser.LexicalizedParser.&lt;init&gt;(LexicalizedParser.java:168) at edu.stanford.nlp.parser.lexparser.LexicalizedParser.&lt;init&gt;(LexicalizedParser.java:154) at com.tcs.srl.ssa.SSAInvoker.&lt;init&gt;(SSAInvoker.java:21) at com.tcs.srl.ssa.SSAInvoker.main(SSAInvoker.java:53) Caused by: java.io.InvalidClassException: edu.stanford.nlp.stats.Counter; edu.stanford.nlp.stats.Counter; class invalid for deserialization at java.io.ObjectStreamClass.checkDeserialize(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.defaultReadFields(Unknown Source) at java.io.ObjectInputStream.readSerialData(Unknown Source) at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source) at java.io.ObjectInputStream.readObject0(Unknown Source) at java.io.ObjectInputStream.readObject(Unknown Source) at edu.stanford.nlp.parser.lexparser.LexicalizedParser.getParserDataFromSerializedFile(LexicalizedParser.java:814) ... 5 more Caused by: java.io.InvalidClassException: edu.stanford.nlp.stats.Counter; class invalid for deserialization at java.io.ObjectStreamClass.initNonProxy(Unknown Source) at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source) at java.io.ObjectInputStream.readClassDesc(Unknown Source) ... 17 more </code></pre> <p>I am new to Java world so I dont to why this error is coming and what should I do to avoid it.</p> <p>I googled for this error then I found out that this error comes because of some version mismatch which I think is something similar to dll hell of windows API. Am I correct? </p> <p>Anyone knows why this kind of error comes? and what should we do to avoid it?</p> <p>Please enlighten !!!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload