I have a webapplication using Hibernate and Jpa and want to add search via hibernate-search. I use the following hibernate versions: hibernate-core-3.3.2.GA hibernate-annotations-3.4.0.GA hibernate-entitymanager-3.4.0.GA hibernate-search-3.2.1.Final And for lucene: lucene-core-2.9.3
The following code compiles perfectly fine:
public List<Story> search(org.apache.lucene.search.Query luceneQuery, int offset, int limit) {
try {
FullTextEntityManager ftem = Search.getFullTextEntityManager(entityManager);
javax.persistence.Query query = ftem.createFullTextQuery(luceneQuery, Story.class);
query.setFirstResult(offset);
query.setMaxResults(limit);
return query.getResultList();
}
catch(NoResultException ex) {
return new ArrayList<Story>();
}
}
Now, this is where the fun starts, as this is the error I get upon using the above method:
java.lang.LinkageError: loader constraint violation: when resolving interface method "org.hibernate.search.jpa.FullTextEntityManager.createFullTextQuery(Lorg/apache/lucene/search/Query;[Ljava/lang/Class;)Lorg/hibernate/search/jpa/FullTextQuery;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, nl/dela/familieportret/dao/jpa/StoryDaoJpa, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, org/hibernate/search/jpa/FullTextEntityManager, have different Class objects for the type org/apache/lucene/search/Query used in the signature
At first I thought hibernate-search was compiled to another version of lucene, but this particular version of hibernate-search even ships with lucene-2.9.3.
I'm not sure where to start looking, so any help would be appreciated.
BTW, I'm using maven, struts 2 and spring 3 if that is any help.