Currently the automated tests pass, but only because other tests were executed in the same JVM just a moment before, which initialized the (*mutable!*) static variables org.hibernate.search.analyzer.impl.RemoteAnalyzerReference.DEFAULT and org.hibernate.search.analyzer.impl.RemoteAnalyzerReference.PASS_THROUGH.
In the common case, index managers have been created when org.hibernate.search.engine.impl.ConfigContext.initLazyAnalyzerReferences(IndexManagerHolder) is called in org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchConfiguration, BuildContext, SearchMapping), allowing the analyzers to be initialized: we use the index managers to determine which type of analyzers is used (remote or Lucene).
In the dynamic sharding case, the index managers are not created yet when initializing the analyzers and thus the analyzers are not initialized, which results in a dangling remote analyzer reference, which ultimately explodes.
Index managers are not yet created because they are created lazily when using dynamic sharding, as shown in IndexManagerHolder line 97.
The analyzer initialization should not rely on the index managers being created before hand, now that we have the notion of IndexManagerType.
Relevant tests: everything in package org.hibernate.search.test.shards. Please make sure to enable those tests when solving this ticket.