NoClassDefFoundError exception with SearchSourceBuilder (6.0) in GWT server side

Hi!

I try to query my local elastic search instance via high level rest client with:
SearchRequest searchRequest = new SearchRequest("jobs");
searchRequest.types("job");
SearchSourceBuilder ssb = new SearchSourceBuilder();
ssb.query(QueryBuilders.matchAllQuery());
searchRequest.source(ssb);

But searchRequest throws a NoSuchFieldError due to another exception in SearchSourceBuilder (NoClassDefFoundError).
I tried elastic version 6.0 and 5.6.4.

The code sample above is called on the server side of my gwt application.
I cleared my maven repo, reimport,... but no success.
Any ideas please?

What is the full error / stacktrace?

Method threw 'java.lang.NoClassDefFoundError' exception. Cannot evaluate org.elasticsearch.search.builder.SearchSourceBuilder.toString()
This is thrown when the default constructor in SearchSourceBuilder is called in the constructor for SearchRequest(String... indices) (SearchRequest:60)

There is no clear stacktrace, it's only visible that the field source in SearchRequest contains the message above (bold).
When I execute the request gwt catches an InvocatoinTargetException with the cause:
java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.common.xcontent.json.JsonXContent
I guess this is just the resulting error from the corrupt request.

How did you import the High Level Rest Client in your project?

via maven:

org.elasticsearch.client
elasticsearch-rest-high-level-client
6.0.0

That's the only elasticsearch dependency in my pom.
I'll try an isolated version because I think it is maybe a clash with another dependency in the pom:

	</dependency>
	<dependency>
		<groupId>com.google.gwt</groupId>
		<artifactId>gwt-elemental</artifactId>
		<version>${gwt.version}</version>
		<scope>provided</scope>
	</dependency>
	<dependency>
		<groupId>com.google.gwt</groupId>
		<artifactId>gwt-dev</artifactId>
		<version>${gwt.version}</version>
		<scope>provided</scope>
	</dependency>
	<dependency>
		<groupId>com.google.gwt</groupId>
		<artifactId>gwt-codeserver</artifactId>
		<version>${gwt.version}</version>
		<scope>provided</scope>
	</dependency>
	<dependency>
		<groupId>com.gwtplatform</groupId>
		<artifactId>gwtp-mvp-client</artifactId>
		<version>${gwtp.version}</version>
	</dependency>
	<dependency>
		<groupId>com.gwtplatform</groupId>
		<artifactId>gwtp-dispatch-rpc-client</artifactId>
		<version>${gwtp.version}</version>
	</dependency>
	<dependency>
		<groupId>com.gwtplatform</groupId>
		<artifactId>gwtp-dispatch-rpc-server-guice</artifactId>
		<version>${gwtp.version}</version>
	</dependency>
	<dependency>
		<groupId>com.gwtplatform</groupId>
		<artifactId>gwtp-dispatch-rpc-shared</artifactId>
		<version>${gwtp.version}</version>
	</dependency>

	<dependency>
		<groupId>com.google.inject</groupId>
		<artifactId>guice</artifactId>
		<version>${guice.version}</version>
	</dependency>
	<dependency>
		<groupId>com.google.inject.extensions</groupId>
		<artifactId>guice-servlet</artifactId>
		<version>${guice.version}</version>
	</dependency>
	<dependency>
		<groupId>com.google.inject.extensions</groupId>
		<artifactId>guice-assistedinject</artifactId>
		<version>${guice.version}</version>
	</dependency>
	<dependency>
		<groupId>com.google.gwt.inject</groupId>
		<artifactId>gin</artifactId>
		<version>${gin.version}</version>
	</dependency>
	<dependency>
	    <groupId>com.google.maps</groupId>
	    <artifactId>google-maps-services</artifactId>
	    <version>0.1.6</version>
	</dependency>

	<dependency>
	    <groupId>org.ektorp</groupId>
	    <artifactId>org.ektorp</artifactId>
	    <version>1.4.4</version>
	</dependency>
	<dependency>
		<groupId>com.github.ldriscoll</groupId>
		<artifactId>ektorplucene</artifactId>
		<version>0.2.0</version>
	</dependency>

	<dependency>
		<groupId>org.mindrot</groupId>
		<artifactId>jbcrypt</artifactId>
		<version>0.3m</version>
	</dependency>
	<dependency>
		<groupId>javax.validation</groupId>
		<artifactId>validation-api</artifactId>
		<version>1.0.0.GA</version>
	</dependency>
	<dependency>
		<groupId>org.hibernate</groupId>
		<artifactId>hibernate-validator</artifactId>
		<version>4.1.0.Final</version>
	</dependency>

	<dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-api</artifactId>
		<version>1.7.21</version>
	</dependency>
	<dependency>
		<groupId>org.slf4j</groupId>
		<artifactId>slf4j-log4j12</artifactId>
		<version>1.7.21</version>
	</dependency>
	<dependency>
		<groupId>org.apache.logging.log4j</groupId>
		<artifactId>log4j-core</artifactId>
		<version>2.7</version>
	</dependency>

	<dependency>
		<groupId>commons-fileupload</groupId>
		<artifactId>commons-fileupload</artifactId>
		<version>1.3.1</version>
	</dependency>
	<dependency>
		<groupId>org.vectomatic</groupId>
		<artifactId>lib-gwt-svg</artifactId>
		<version>0.5.10</version>
	</dependency>
	
	<dependency>
	    <groupId>com.arcbees.analytics</groupId>
	    <artifactId>universal-analytics</artifactId>
	    <version>2.1</version>
	</dependency>

	<dependency>
		<groupId>org.gwtopenmaps.openlayers</groupId>
		<artifactId>gwt-openlayers-client</artifactId>
		<version>1.1-SNAPSHOT</version>
	</dependency>

	<dependency>
		<groupId>org.xhtmlrenderer</groupId>
		<artifactId>flying-saucer-pdf</artifactId>
		<version>9.0.7</version>
	</dependency>

	<!-- Test -->
	<dependency>
		<groupId>junit</groupId>
		<artifactId>junit</artifactId>
		<version>${junit.version}</version>
		<scope>test</scope>
	</dependency>
	<dependency>
		<groupId>org.jukito</groupId>
		<artifactId>jukito</artifactId>
		<version>${jukito.version}</version>
		<scope>test</scope>
	</dependency>

	<dependency>
		<groupId>org.moxieapps</groupId>
		<artifactId>moxieapps</artifactId>
		<version>1.1.0</version>
		<scope>system</scope>
		<systemPath>${project.basedir}/lib/org.moxieapps.gwt.uploader-1.1.0.jar</systemPath>
	</dependency>

	<!--Material Design GWT-->

	<dependency>
		<groupId>com.github.gwtmaterialdesign</groupId>
		<artifactId>gwt-material</artifactId>
		<version>2.0-rc7</version>
		<scope>provided</scope>
	</dependency>

	<dependency>
		<groupId>com.github.gwtmaterialdesign</groupId>
		<artifactId>gwt-material-addins</artifactId>
		<version>2.0-rc7</version>
		<scope>provided</scope>
	</dependency>

	<dependency>
		<groupId>com.github.gwtmaterialdesign</groupId>
		<artifactId>gwt-material-themes</artifactId>
		<version>2.0-rc7</version>
		<scope>provided</scope>
	</dependency>
	<dependency>
		<groupId>com.github.gwtmaterialdesign</groupId>
		<artifactId>gwt-material-jquery</artifactId>
		<version>2.0-rc7</version>
		<scope>provided</scope>
	</dependency>
	<dependency>
		<groupId>com.github.gwtmaterialdesign</groupId>
		<artifactId>gwt-material-table</artifactId>
		<version>2.0-rc7</version>
		<scope>provided</scope>
	</dependency>

	<!--Guava-->

	<dependency>
		<groupId>com.google.guava</groupId>
		<artifactId>guava</artifactId>
		<version>23.0</version>
	</dependency>

	<dependency>
		<groupId>com.google.guava</groupId>
		<artifactId>guava-gwt</artifactId>
		<version>23.0</version>
	</dependency>

	<dependency>
		<groupId>org.mockito</groupId>
		<artifactId>mockito-core</artifactId>
		<version>2.1.0-RC.2</version>
	</dependency>

	<dependency>
		<groupId>org.jsoup</groupId>
		<artifactId>jsoup</artifactId>
		<version>1.10.2</version>
	</dependency>

	<dependency>
		<groupId>org.apache.httpcomponents</groupId>
		<artifactId>httpclient</artifactId>
		<version>4.5.3</version>
	</dependency>
	<dependency>
		<groupId>commons-io</groupId>
		<artifactId>commons-io</artifactId>
		<version>2.5</version>
	</dependency>

	<dependency>
		<groupId>org.elasticsearch.client</groupId>
		<artifactId>elasticsearch-rest-high-level-client</artifactId>
		<version>6.0.0</version>
	</dependency>

Could you try with only elasticsearch dependency so it will tell us if this is caused by a conflict or something else?

Ok, I got it up and running. I had a dependency on ektorp for my couchdb, because I wanted to port all couchdb entries into elastic. After removing all ektorp couchdb and lucene dependencies it worked perfectly. Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.