0
Exception in thread "main" java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    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:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at NVoting.<init>(NVoting.java:143)
    at Main.main(Main.java:8)

on this line:

booleanQuery.add(new BM25BooleanQuery(current_tags[i], 
                            "tags",
                            new StandardAnalyzer(org.apache.lucene.util.Version.LUCENE_31)), 
                            BooleanClause.Occur.SHOULD);

I'm using an implementation of BM25 Okapi retrieval system: http://nlp.uned.es/~jperezi/Lucene-BM25

Can you help me to fix the issue ? I'm using Lucene 3.1 I've also tried Lucene 2.9.4 with no luck.

thanks

user680406
  • 5,637
  • 6
  • 24
  • 19
  • This may be helpful http://stackoverflow.com/questions/1980452/what-causes-java-lang-incompatibleclasschangeerror It means you are trying to use two libraries which were not compiled together and have a breaking change between them i.e. they are incompatible. – Peter Lawrey Apr 19 '11 at 12:56

2 Answers2

1

Either you use different third-party libraries for compilation and execution or some of your third-party libraries are not compatible.

The error may happen if you use one version of a library for compilation and another one (with slightly different API) for execution. Double check all your library versions (do they fit?) and you classpaths.

Andreas Dolk
  • 113,398
  • 19
  • 180
  • 268
0

I'm not a Java programmer, so take this answer with caution, but here's the facts as I see them:

  1. The last update date of the BM25 implementation is January 2009 (or perhaps December 2009)
  2. Lucene 3.1 was released in March this year
  3. IncompatibleClassChangeError indicates an incompatible change in a dependent class

So I think you'll either need to use the same version of Lucene as the BM25 implementation used when it was built or rebuild it from source (if that's a possibility).

Good luck,

Adrian Conlon
  • 3,941
  • 1
  • 21
  • 17