HSEARCH000501 cannot add Custom Analyzer to perstience.xml

It seems that this code, which detects that we’re running in WildFly (basically) and that Hibernate Search must start later, didn’t work.

Now, why? From the top of my head, I can see two reasons:

  1. You started Hibernate ORM yourself, instead of letting WildFly do the work.
    Don’t do that. If you need to upgrade to a later version of Hibernate ORM, see this documentation.
  2. You have a copy of Hibernate ORM bundled with your application, and it’s causing all kinds of classloading problems, leading to the ExtendedBeanManager class being loaded twice in different classloaders, and to the instanceof in the code I linked not working.
    Don’t do that. Make sure Hibernate ORM JARs are not included in your deployment.

If none of the above works, then it’s something else, something I’ve never seen. I’ll need you to go through the code I linked in debug mode, to tell me what’s happening exactly, and to give me the value of unknownBeanManager, of Arrays.toString(unknownBeanManager.getClass().getInterfaces()), of org.hibernate.jpa.event.spi.jpa.ExtendedBeanManager.class and of org.hibernate.resource.beans.container.spi.ExtendedBeanManager.class.