-
1. Re: HSearch and ISPN-658: You are not starting all your caches at the same time
sannegrinovero Oct 6, 2011 11:43 AM (in response to hvico)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
-
2. Re: HSearch and ISPN-658: You are not starting all your caches at the same time
hvico Oct 5, 2011 7:51 PM (in response to sannegrinovero)Excelent Sanne, I will try your suggested fixes!
Thanks!
-
3. Re: HSearch and ISPN-658: You are not starting all your caches at the same time
hvico Nov 3, 2011 12:19 PM (in response to sannegrinovero)Hi!
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
at org.hibernate.search.infinispan.CacheManagerServiceProvider.locateCacheManager(CacheManagerServiceProvider.java:115)
at org.hibernate.search.infinispan.CacheManagerServiceProvider.start(CacheManagerServiceProvider.java:106)
at org.hibernate.search.engine.ServiceManager$ServiceProviderWrapper.increaseCounter(ServiceManager.java:135)
at org.hibernate.search.engine.ServiceManager.requestService(ServiceManager.java:88)
at org.hibernate.search.spi.SearchFactoryBuilder$BuildContext.requestService(SearchFactoryBuilder.java:656)
at org.hibernate.search.infinispan.InfinispanDirectoryProvider.start(InfinispanDirectoryProvider.java:83)
at org.hibernate.search.store.DirectoryProviderFactory.startDirectoryProviders(DirectoryProviderFactory.java:144)
at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:403)
at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:262)
at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:144)
at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:151)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
My cache is initialized this way:
EmbeddedCacheManager cache = new DefaultCacheManager("infinispan.xml");
and then is exposed via JNDI:
bind(jndiName,cache,org.infinispan.Cache.class,rootCtx);
Any help would be appreciated.
Thanks,
-
4. Re: HSearch and ISPN-658: You are not starting all your caches at the same time
sannegrinovero Nov 3, 2011 12:33 PM (in response to hvico)1 of 1 people found this helpfulHi,
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.
-
5. Re: HSearch and ISPN-658: You are not starting all your caches at the same time
hvico Nov 3, 2011 1:15 PM (in response to sannegrinovero)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.
Any suggestion?
Thanks,
-
6. Re: HSearch and ISPN-658: You are not starting all your caches at the same time
hvico Nov 3, 2011 2:29 PM (in response to hvico)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.
Thanks!
-
7. Re: HSearch and ISPN-658: You are not starting all your caches at the same time
sannegrinovero Nov 3, 2011 2:37 PM (in response to hvico)Right! you can always plug in your own DirectoryProvider.
I didn't know about the Logger incompatibility with JBoss4, good to know.