Sunday, August 28, 2011

Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath



If you get the following message on a Hibernate project:

204 [main] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the           classpath. Hibernate Search is not enabled.                                                                 
that' because in some way  it was not possible to find the respective library that contains that class.
Check these two possibilities:

1. If using Eclipse, first refresh your project then go to the menu, preferences, build path, library tab.
Press the "add jar" button and point to your project's lib directory.
If it happens to appear any jar file that's because it was not registered on the classpath. Select all of them and press "ok button".
Return to your project and run again. Sometimes it's advisable to "clean" the project before just to make sure.

2. If the problem is not solved by the prior procedure, certainly the respective library is missing on your project's environment.
To solve this, first download the Hibernate's libraries at http://www.hibernate.org/downloads
For instance, the "hibernate-search-3.4.1.Final.tar.gz" or the zip version or choose a newer version if your project uses newer libraries or older version if the other way around.
Now, the fastest way is to copy the following files to your project's lib:

hibernate-search-3.4.1.Final.jar
hibernate-search-analyzers-3.4.1.Final.jar
hibernate-search-infinispan-3.4.1.Final.jar

Remember that you need to refresh you project and add the respective jars on the project's build path - see description on first procedure, above, and repeat it.

If after that you still get other error or warning messages that is about "missing things", do the following to solve this problem at once:

Select all the jars from the downloaded version of hibernate and copy them to a temporary folder.
Begin comparing the versions of all your project's jars with the temporary folder that contains the hibernate's jars.
Remember that the versions shall be compatible, so it's reasonable that the versions should be most close as possible, better if they match, when possible.
Replace your project's jar with the newest versions considering you project's version and complement with the other files that are missing. This procedure will help you to avoid having new problems in the future.
After all missing files were added to your project, refresh it and update the build path as commented above.
Remember that this procedure is valid for a Hibernate project.

You project will shall run without error/warning messages now.

NOTE:
If you use hibernate Annotations, you do not need to configure the event listeners, they are registered for you transparently.


No comments:

Post a Comment

eclipse: java: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" or Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder

  >PROBLEM Using Eclipse, you try to run a simple logging test using "org.slf4j.Logger" like the sample below: package Test; im...