You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Da...@coop.ch on 2024/01/09 17:14:06 UTC

SolrJ with Spring Boot 3.2

Hello Everyone at Solr


This Email is possibly a duplicate, but as I did not find my Mail appear in the archives the first time I'm sending it a second time.



Today I wanted to bump the Spring Boot version from 3.1.7 to 3.2.1.
With the first Version my application just worked, but now I get the fallowing Exception:

Failed to instantiate [org.apache.solr.client.solrj.SolrClient]: Factory method 'solrClient' threw exception with message: org/eclipse/jetty/client/util/InputStreamResponseListener



The Problem is, that InputStreamResponseListener was moved to a new package. org.eclipse.jetty.client.util to org.eclipse.jetty.client (without util).

This was changed in https://github.com/jetty/jetty.project/commit/a1c5cefd0d5657df04e5364cca9315aa4e2a1aef



The newest SolrJ Version 9.4 still uses an older eclipse client 10.0.17 (BEFORE the namespace change).



https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent/3.1.7#:~:text=jetty%2Dreactive%2Dhttpclient-,3.0.11,-4.0.2

While Spring Boot Starter Parent 3.1.7 uses jetty-reactive-httpclient 3.0.11

https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-reactive-httpclient/3.0.11#:~:text=%C2%BB%20jetty%2Dclient-,11.0.19,-12.0.5

And jetty-reactive-httpclient 3.0.11 uses jetty-client 11.0.19 (which is compatible with 10.0.17)



The Spring Boot Starter Parent uses 12.0.17 (AFTER the namespace change), which in turn results in a conflict.

You can find the version being used indirectly

https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent/3.2.1#:~:text=jetty%2Dreactive%2Dhttpclient-,4.0.1,-4.0.2

The spring boot starter uses jetty-reactive-httpclient 4.0.1

https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-reactive-httpclient/4.0.1#:~:text=%C2%BB%20jetty%2Dclient-,12.0.3,-12.0.5

jetty-reactive-httpclient 4.0.1 uses jetty-client 12.0.3



TLDR: If you upgrade from spring boot starter parent 3.1.7 to 3.2.1 a new jetty client will be used, which conflicts with the jetty client being used by solrj



Can I create a Ticket on your Jira (I already have a Jira account) or is there already a ticket about this issue?



With kind regards,



Coop Genossenschaft

Dario Viva

4002 Basel

Re: SolrJ with Spring Boot 3.2

Posted by Shawn Heisey <ap...@elyograg.org.INVALID>.
On 1/9/24 10:14, Dario.Viva@coop.ch wrote:
> Hello Everyone at Solr
> 
> This Email is possibly a duplicate, but as I did not find my Mail appear in the archives the first time I'm sending it a second time.
> 
> Today I wanted to bump the Spring Boot version from 3.1.7 to 3.2.1.
> With the first Version my application just worked, but now I get the fallowing Exception:
> 
> Failed to instantiate [org.apache.solr.client.solrj.SolrClient]: Factory method 'solrClient' threw exception with message: org/eclipse/jetty/client/util/InputStreamResponseListener
> 
> The Problem is, that InputStreamResponseListener was moved to a new package. org.eclipse.jetty.client.util to org.eclipse.jetty.client (without util).

SolrJ uses the Jetty Client version 10.

Spring Boot 3.2.1 updates all Jetty dependencies to version 12.0.5, and 
neither Solr nor SolrJ has been qualified to work with Jetty 12.

I do not know what dependency manager you are using, but I found the way 
to force Jetty dependencies to version 10 in gradle using a 
"configurations" section:



plugins {
	id 'java'
	id 'org.springframework.boot' version '3.2.1'
	id 'io.spring.dependency-management' version '1.1.4'
}

group = 'org.elyograg.test'
version = '0.0.1-SNAPSHOT'

java {
	sourceCompatibility = '17'
}

repositories {
	mavenCentral()
}

configurations {
	all {
		resolutionStrategy {
			eachDependency { DependencyResolveDetails details ->
				if (details.requested.group == 'org.eclipse.jetty') {
					details.useVersion '10+'
				}
			}
		}
	}
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter'
	implementation group: 'org.apache.solr', name: 'solr-solrj', version: '9+'
	testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

tasks.named('test') {
	useJUnitPlatform()
}



Thanks,
Shawn