InfinispanDirectoryProvider with Wildfly 10.1

扶醉桌前 提交于 2019-12-06 16:31:33

The short answer is:

  • get the right zip file
  • adjust your configuration accordingly

Detailed explanation:

To use the Infinispan Lucene Directory in WildFly you need to download the Infinispan distribution of its custom modules for WildFly; you can find them on the Infinispan downloads page, it's the zip named "WildFly/EAP Modules".

Uncompress this zip file in your WildFly /modules directory. It might help to look at what this adds: among others you will find this contains a module named "org.infinispan.hibernate-search.directory-provider" and having slot "for-hibernatesearch-5.5".

It will also contain a new copy of Infinispan, but since it uses a different module "slot" than the one included in WildFly, you're not overwriting it. Existing applications and WidlFly's own usage of Infinispan will still be ablet to use the existing module, as classloader isolation actually works.

Within WildFly the Hibernate Search module "org.hibernate.search.engine" has an optional dependency on this module you just added, so if you use the Hibernate Search version included in WildFly you're done!

You configuration isn't using the Wildfly module though; remove the line "wildfly.jpa.hibernate.search.module" and remove the Hibernate Search jars from your deployment if you have them there.

Keep in mind that you can't configure the Caches of this Infinispan instance using your WildFly's "standalone.xml": you're adding an additional, different module of Infinispan. This could for example be a more recent version of Infinispan than the one included with Wildfly, if you want to. So make sure that those JNDI names do not refer to the Infinispan instance which is bundled with WildFly. The easiest solution might be to not use the JNDI configuration strategy, but to simply include an Infinispan configuration file with your application deployment, and have Hibernate Search refer to that resource to start a new data grid.

Since noone likes to manually download and unzip archives, you can download the modules zip file via Maven from coordinates:

<groupId>org.infinispan</groupId>
<artifactId>infinispan-as-embedded-modules</artifactId>
<version>${infinispan.version}</version>
<type>zip</type>

For example, here you can find how the Infinispan testsuite runs integration tests automatically of this module itself: https://github.com/infinispan/infinispan/blob/8.2.5.Final/integrationtests/as-lucene-directory/pom.xml#L157-L204

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!