title: Hibernate NoSuchFieldError: INSTANCE
body: <p>I'm trying to integrate Hibernate Search with Spring Data JPA, so I wrote a sample code to test it. </p>
  
  <pre><code>@PersistenceContext
  EntityManager em;
  
  @Override
  @Transactional
  public List&lt;Place&gt; findAll() {
      FullTextEntityManager fullTextSession = Search.getFullTextEntityManager(em);
  
      QueryBuilder builder = fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(Place.class).get();
  
      double centerLatitude = 0d;
      double centerLongitude = 0d;
      org.apache.lucene.search.Query luceneQuery = builder
              .spatial()
              .within(100, Unit.KM)
              .ofLatitude(centerLatitude)
              .andLongitude(centerLongitude)
              .createQuery();
  
      javax.persistence.Query jpaQuery =
              fullTextSession.createFullTextQuery(luceneQuery, Place.class);
  
      em.close();
      return jpaQuery.getResultList();
  }
  </code></pre>
  
  <p>And I'm getting exception with following stacktrace. </p>
  
  <pre><code>2016-06-13 17:34:30 INFO  LogHelper:31 - HHH000204: Processing PersistenceUnitInfo [
      name: default
      ...]
  2016-06-13 17:34:30 INFO  Version:37 - HHH000412: Hibernate Core {5.0.6.Final}
  2016-06-13 17:34:30 INFO  Environment:213 - HHH000206: hibernate.properties not found
  2016-06-13 17:34:30 INFO  Environment:317 - HHH000021: Bytecode provider name : javassist
  2016-06-13 17:34:30 INFO  Version:66 - HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
  2016-06-13 17:34:31 INFO  Dialect:154 - HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect
  2016-06-13 17:34:31 INFO  Version:30 - HV000001: Hibernate Validator 5.2.4.Final
  2016-06-13 17:34:31 INFO  Version:26 - HSEARCH000034: Hibernate Search 5.5.3.Final
  2016-06-13 17:34:32 INFO  SchemaUpdate:105 - HHH000228: Running hbm2ddl schema update
  2016-06-13 17:34:32 WARN  ConfigContext:346 - HSEARCH000075: Configuration setting hibernate.search.lucene_version was not specified: using LUCENE_CURRENT.
  //...    
  
  [localhost-startStop-1] WARN org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in pl.project.api.config.RepositoryConfig: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: INSTANCE
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
  //...
  Caused by: java.lang.NoSuchFieldError: INSTANCE
      at org.hibernate.search.store.impl.DefaultLockFactoryCreator.createLockFactory(DefaultLockFactoryCreator.java:60)
      at org.hibernate.search.store.impl.DirectoryProviderHelper.getLockFactory(DirectoryProviderHelper.java:134)
      at org.hibernate.search.store.impl.DirectoryProviderHelper.createFSIndex(DirectoryProviderHelper.java:124)
      at org.hibernate.search.store.impl.FSDirectoryProvider.initialize(FSDirectoryProvider.java:53)
      at org.hibernate.search.store.spi.BaseDirectoryProviderService.initialize(BaseDirectoryProviderService.java:64)
      at org.hibernate.search.store.spi.BaseDirectoryProviderService.create(BaseDirectoryProviderService.java:49)
      at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.createDirectoryProvider(DirectoryBasedIndexManager.java:230)
      at org.hibernate.search.indexes.spi.DirectoryBasedIndexManager.initialize(DirectoryBasedIndexManager.java:90)
      at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:256)
      at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManager(IndexManagerHolder.java:513)
      at org.hibernate.search.indexes.impl.IndexManagerHolder.createIndexManagers(IndexManagerHolder.java:482)
      at org.hibernate.search.indexes.impl.IndexManagerHolder.buildEntityIndexBinding(IndexManagerHolder.java:91)
      at org.hibernate.search.spi.SearchIntegratorBuilder.initDocumentBuilders(SearchIntegratorBuilder.java:358)
      at org.hibernate.search.spi.SearchIntegratorBuilder.buildNewSearchFactory(SearchIntegratorBuilder.java:199)
      at org.hibernate.search.spi.SearchIntegratorBuilder.buildSearchIntegrator(SearchIntegratorBuilder.java:117)
      at org.hibernate.search.hcore.impl.HibernateSearchSessionFactoryObserver.sessionFactoryCreated(HibernateSearchSessionFactoryObserver.java:75)
      at org.hibernate.internal.SessionFactoryObserverChain.sessionFactoryCreated(SessionFactoryObserverChain.java:35)
      at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:530)
      at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:444)
      at     org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879)
  org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
      ... 21 
  </code></pre>
  
  <p>I'm juggling with my dependencies and their versions but nothing changes.<br>
  My dependencies</p>
  
  <pre><code>    &lt;!-- Hibernate --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-ehcache&lt;/artifactId&gt;
          &lt;version&gt;5.0.6.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;5.0.6.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
          &lt;version&gt;5.0.6.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
          &lt;version&gt;5.2.4.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.transaction&lt;/groupId&gt;
          &lt;artifactId&gt;jta&lt;/artifactId&gt;
          &lt;version&gt;1.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-search-orm&lt;/artifactId&gt;
          &lt;version&gt;5.5.3.Final&lt;/version&gt;
      &lt;/dependency&gt;
  </code></pre>
  
  <p>I'm also using <code>Spring Data JPA</code> from ReleaseTrain (<code>Hopper-SR1</code>) so it's <code>Spring Data JPA 1.10.1</code> </p>
  
  <p>My Place.class</p>
  
  <pre><code>@Getter
  @Setter
  @Entity
  @Indexed
  @Spatial
  public class Place implements Serializable {
  
      private static final long serialVersionUID = -8379536848917838560L;
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Id
      @Column(name = "place_id")
      private Long id;
  
      //...
      @Longitude
      private Double lng;
  
      @Latitude
      private Double lat;
      //...
      }
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/37762617/configuring-hibernate-search-with-entitymanager">Here is my RepositoryConfig</a>
  <a href="http://pastebin.com/DwA7r4Q1" rel="nofollow">mvn dependency:tree of my parent module</a></p>