Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate Search Class Not Found Exception Lucene Field$TermVector

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
like image 426
Deepak Kumar Avatar asked Oct 16 '22 15:10

Deepak Kumar


1 Answers

Wrong lucene version, use Lucene 5.5.

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

like image 132
femtoRgon Avatar answered Nov 02 '22 23:11

femtoRgon