Uploaded image for project: 'OpenNLP'
  1. OpenNLP
  2. OPENNLP-742

Adding serialVersionUID to POSModel Class

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.6.0
    • Fix Version/s: None
    • Component/s: POS Tagger
    • Labels:
      None
    • Environment:
      Mac OS X 10.9.5

      Description

      I had a custom POSModel that I serialized and store as a .bin file using Java 1.7. Now, I want to deserialize and use it in a POSTaggerME using Java 1.6. However, I get the following error at the point that I read in the binary file:

      java.lang.UnsupportedClassVersionError: opennlp/tools/postag/POSModel : Unsupported major.minor version 51.0
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
      at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

      According to the following StackOverflow post, it should be possible to resolve this by manually assigning a serialVersionUID to the POSModel class (which is what I call the serialize() method on):

      http://stackoverflow.com/questions/893433/does-using-compilers-from-different-jdk-versions-on-the-same-source-file-break

      I'm using the following dependency:
      <dependency>
      <groupId>org.apache.opennlp</groupId>
      <artifactId>opennlp-tools</artifactId>
      <version>1.6.0-SNAPSHOT</version>
      </dependency>

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nkelkar Nishant Kelkar
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: