# java.lang.NoSuchMethodError: 'java.lang.String org.hibernate.search.engine.Version.versionString()

**URL:** <https://discourse.hibernate.org/t/java-lang-nosuchmethoderror-java-lang-string-org-hibernate-search-engine-version-versionstring/6288>\
**Category:** Hibernate Search\
**Created:** [April 29, 2022, 10:54pm UTC](https://discourse.hibernate.org/t/java-lang-nosuchmethoderror-java-lang-string-org-hibernate-search-engine-version-versionstring/6288 "2022-04-29T22:54:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arelowo\_Alao](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/arelowo_alao/32/1870_2.png) [@Arelowo\_Alao](https://discourse.hibernate.org/u/Arelowo_Alao)\
**Post date:** [April 29, 2022, 10:54pm UTC](https://discourse.hibernate.org/t/java-lang-nosuchmethoderror-java-lang-string-org-hibernate-search-engine-version-versionstring/6288/1 "2022-04-29T22:54:53Z")

</div>

I’m having a problem trying to upgrade hibernate search. I had ti working previously but now I’m getting the following error no matter what I do.

```auto
Apr 29, 2022 6:50:45 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [fvap] in web application [/ROOT] threw load() exception
java.lang.NoSuchMethodError: 'java.lang.String org.hibernate.search.engine.Version.versionString()'
	at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchIntegrator.integrate(HibernateSearchIntegrator.java:65)
	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:275)
	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:708)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)

```

Here are my pom.xml imports

```auto
<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<surefire.skipTests>false</surefire.skipTests>
		<lucene.version>8.7.0</lucene.version>
		<hibernate.version>5.4.0.Final</hibernate.version>
		<hibernate.orm.version>5.4.0.Final</hibernate.orm.version>
		<hibernate.annotations.version>5.1.2.Final</hibernate.annotations.version>
		<hibernate-search.version>6.0.9.Final</hibernate-search.version>

```

```auto
		<!-- Hibernate -->
		<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-core</artifactId>
			<version>${hibernate.version}</version>
		</dependency>
<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-search-orm</artifactId>
			<version>${hibernate.orm.version}</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate.common</groupId>
			<artifactId>hibernate-commons-annotations</artifactId>
			<version>${hibernate.annotations.version}</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate.search</groupId>
			<artifactId>hibernate-search-mapper-orm</artifactId>
			<version>${hibernate-search.version}</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate.search</groupId>
			<artifactId>hibernate-search-backend-lucene</artifactId>
			<version>${hibernate-search.version}</version>
		</dependency>
		<dependency>
			<groupId>org.hibernate.search</groupId>
			<artifactId>hibernate-search-v5migrationhelper-orm</artifactId>
			<version>${hibernate-search.version}</version>
		</dependency>
<!-- Lucene -->
		<dependency>
			<groupId>org.apache.lucene</groupId>
			<artifactId>lucene-core</artifactId>
			<version>${lucene.version}</version>
		</dependency>
		<!-- <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-analyzers-common</artifactId> <version>${lucene.version}</version> </dependency> -->
		<dependency>
			<groupId>org.apache.lucene</groupId>
			<artifactId>lucene-highlighter</artifactId>
			<version>${lucene.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.lucene</groupId>
			<artifactId>lucene-queryparser</artifactId>
			<version>${lucene.version}</version>
		</dependency>

```

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [May 2, 2022, 6:40am UTC](https://discourse.hibernate.org/t/java-lang-nosuchmethoderror-java-lang-string-org-hibernate-search-engine-version-versionstring/6288/2 "2022-05-02T06:40:39Z")

</div>

Most of the time, if you get a `NoSuchMethodError`, the cause is a JAR in your classpath with the wrong version.

Here, I think you are importing a version of `hibernate-search-engine` that is not `6.0.9.Final`.

The cause is your double dependency to both Hibernate Search 5 and Hibernate Search 6:

```auto
<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-search-orm</artifactId>
			<version>${hibernate.orm.version}</version> <!-- 5.4.0.Final -->
		</dependency>
                <!-- .... -->
		<dependency>
			<groupId>org.hibernate.search</groupId>
			<artifactId>hibernate-search-mapper-orm</artifactId>
			<version>${hibernate-search.version}</version> <!-- 6.0.9.Final -->
		</dependency>

```

You end up with two copies of `org.hibernate.search.engine.Version` in your classpath, and here it seems Hibernate Search 6 accessed the copy of `Version` from Hibernate Search 5. Which, obviously, doesn’t work.

Anyway… Don’t use both Hibernate Search 5 and Hibernate Search 6 in the same application. Remove this from your POM:

```auto

<dependency>
			<groupId>org.hibernate</groupId>
			<artifactId>hibernate-search-orm</artifactId>
			<version>${hibernate.orm.version}</version>
		</dependency>

```

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [May 2, 2022, 6:49am UTC](https://discourse.hibernate.org/t/java-lang-nosuchmethoderror-java-lang-string-org-hibernate-search-engine-version-versionstring/6288/3 "2022-05-02T06:49:09Z")

</div>

Seems like this question was copied from Stackoverflow: [java.lang.NoSuchMethodError: 'java.lang.String org.hibernate.search.engine.Version.versionString()' - Stack Overflow](https://stackoverflow.com/q/72064421/6692043)

Closing, continuing the discussion (if any) on Stackoverflow.

---

<div class="post-metadata">

**Author:** ![yrodiere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/yrodiere/32/1760_2.png) [@yrodiere](https://discourse.hibernate.org/u/yrodiere)\
**Post date:** [May 2, 2022, 6:49am UTC](https://discourse.hibernate.org/t/java-lang-nosuchmethoderror-java-lang-string-org-hibernate-search-engine-version-versionstring/6288/4 "2022-05-02T06:49:12Z")

</div>


