Hibernate Search Class Not Found Exception Lucene Field$TermVector
Asked Answered
T

1

6

I am trying to integrate Hibernate Search into my Spring boot application and I keep getting the following error every time I try to use the @Indexed (org.hibernate.search.annotations.Indexed) annotation

Caused by: java.lang.ClassNotFoundException: org.apache.lucene.document.Field$TermVector
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 133 more

I have the following gradle dependencies that are relevant.

compile 'org.hibernate:hibernate-search-orm:5.10.3.Final'
compile 'org.apache.lucene:lucene-core:7.4.0'

I have also tried it without the lucene dependencies. I also have the following hibernate and JPA dependencies.

compile 'javax.persistence:javax.persistence-api:2.2'
compile 'org.hibernate:hibernate-core:5.3.3.Final'
compile 'org.hibernate:hibernate-java8:5.3.3.Final'
compile 'org.hibernate:hibernate-entitymanager:5.3.3.Final'

It's driving me completely insane because I can't find anything on a tutorial or SO post. Feel free to ask for more context as you see fit.

Edit: Reverting the Lucene version to 5.5.4 gives me the following error

java.lang.ClassNotFoundException: org.apache.lucene.analysis.standard.StandardAnalyzer
Thorn answered 1/8, 2018 at 19:25 Comment(0)
U
3

Wrong lucene version, use Lucene 5.5.

http://hibernate.org/search/releases/5.10/#compatibility

Uyekawa answered 1/8, 2018 at 19:56 Comment(3)
I tried that too. I just get this: java.lang.ClassNotFoundException: org.apache.lucene.analysis.standard.StandardAnalyzerThorn
@DeepakKumar - You need to add lucene's analyzers-common jar as well. Probably the queryparser jar as well, possibly others.Uyekawa
I did both of those, lucene-parent and lucene-grandparent and end up at java.lang.ClassNotFoundException: org.apache.lucene.codecs.lucene60.Lucene60FieldInfosFormat it's infuriating that no where in the Hibernate Documentation does it formally require any of thisThorn

© 2022 - 2024 — McMap. All rights reserved.