Hi. Hibernate Search was developed depending on Infinispan 4.2, which didn't have the startCaches method, so you are right it is not using the recommended way to start Infinispan 5.
The startCaches method was introduced to avoid a timing issue at boot time of Infinispan: if the cluster is started fine then you can ignore the warning; occasionally it might fail to start Infinispan, especially when joining an existing cluster (the second node in your case).
If that is a problem you can
- a) patch Hibernate Search as the fix is trivial
- b) upgrade to Hibernate Search 4
- c) start Infinispan yourself and have Search retrieve it via JNDI
Excelent Sanne, I will try your suggested fixes!
I've been trying to implement the third strategy (start Infinispan myself and have Search retrieve it via JNDI).
I succeeded starting infinispan and exposing it via JNDI, but when my HSearch application tries to retrieve it I am getting the following exception:
Caused by: java.lang.ClassCastException: org.infinispan.manager.DefaultCacheManager cannot be cast to org.infinispan.manager.EmbeddedCacheManager
My cache is initialized this way:
EmbeddedCacheManager cache = new DefaultCacheManager("infinispan.xml");
and then is exposed via JNDI:
Any help would be appreciated.
1 of 1 people found this helpful
that means you're having duplicate class definitions. I guess you're having Infinispan jars with your application, in addition to another place?
Remove them from your app and have it load the same Infinispan classes you're using to start it.
If you can't find the duplicates directly, use a classpath scanning tool like Tattletale.
Hi, thank you again Sanne.
I have infinispan jar inside my HSearch application's lib folder. Initially I copied them inside my server/default/lib directory, but that didn't work because some logging classes that Infinispan require (BasicLogger), conflict with other libs provided by JBoss AS 4.2.
I am starting infinispan in a separate JBoss SAR, and I had to isolate it for the same reason, so it has its own infinispan jars.
Really, this classloader issues are a nightmare, I am really confused.
I found a workaround and fixed it!
I overode the org.hibernate.search.infinispan.CacheManagerServiceProvider class that ships in hibernate-search-infinispan.jar. Now I launch my Infinispan initialization code from there, at the start method before it tries to hook to the JNDI CacheManager.
Right! you can always plug in your own DirectoryProvider.
I didn't know about the Logger incompatibility with JBoss4, good to know.