In our application, I tried to use some libraries whose versions are already defined by Spring Boot (for example lombok, jackson).
I tried adding this dependency:
implementation(platform('org.springframework.boot:spring-boot-dependencies:3.2.3'))
so that I can declare my other dependencies without using an explicit version.
However that caused the server to fail on startup with
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.solr.core.CoreContainer]: Factory method 'solrCoreContainer' threw exception with message: org/eclipse/jetty/client/api/Request$BeginListener
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:177)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:644)
... 94 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/client/api/Request$BeginListener
One big advantage of Spring Boot is that it comes with predefined versions of dependencies that are tested to work together.
For easier maintenance I really don’t want to have to define 3rd party dependencies myself.
How can I achieve this with the a12 setup?
Note: Can easily be reproduced by using the A12 Project Template linked in the geta12 docs at 17.1.2. Download
and just adding the single dependency to the build.gradle in “app” project.
Hello @stephen-warm-graph,
I can reproduce the issue by following your instructions.
In server/app, check with
gradle dependencyInsight --dependency org.eclipse.jetty
we can see the conflict in the jetty version:
There was also a similar question at jsonRpcOperationServer bean could not be created.
Could you please check?
Thanks a lot for the answer!
I think it’s the right track, but after spending quite a while on it, I am about to give up.
I started fixing the version of jetty-client to 10.0.15 (which did not help), then added more and more jetty dependency constraints (see below).
Currently, I am getting this error:
Caused by: org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.apache.solr.core.CoreContainer]:
Factory method 'solrCoreContainer' threw exception with message:
org/eclipse/jetty/http/compression/HuffmanEncoder
...
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/http/compression/HuffmanEncoder
Here is my extended configuration: (Btw: Is there a simpler way to do this with gradle?)
implementation(platform('org.springframework.boot:spring-boot-dependencies:3.2.3')) {
implementation('org.eclipse.jetty:jetty-client') {
version {
strictly '10.0.15'
}
because 'A12 needs a version of the jetty client, that is older than the one configured by Spring Boot dependencies'
}
implementation('org.eclipse.jetty:jetty-http') {
version {
strictly '10.0.15'
}
because 'A12 needs a version of the jetty client, that is older than the one configured by Spring Boot dependencies'
}
implementation('org.eclipse.jetty:jetty-io') {
version {
strictly '10.0.15'
}
because 'A12 needs a version of the jetty client, that is older than the one configured by Spring Boot dependencies'
}
implementation('org.eclipse.jetty:jetty-alpn-client') {
version {
strictly '10.0.15'
}
because 'A12 needs a version of the jetty client, that is older than the one configured by Spring Boot dependencies'
}
implementation('org.eclipse.jetty:jetty-alpn-java-client') {
version {
strictly '10.0.15'
}
because 'A12 needs a version of the jetty client, that is older than the one configured by Spring Boot dependencies'
}
implementation('org.eclipse.jetty:jetty-util') {
version {
strictly '10.0.15'
}
because 'A12 needs a version of the jetty client, that is older than the one configured by Spring Boot dependencies'
}
implementation('org.eclipse.jetty:jetty-security') {
version {
strictly '10.0.15'
}
because 'A12 needs a version of the jetty client, that is older than the one configured by Spring Boot dependencies'
}
implementation('org.eclipse.jetty:jetty-server') {
version {
strictly '10.0.15'
}
because 'A12 needs a version of the jetty client, that is older than the one configured by Spring Boot dependencies'
}
}
It would really be nice if A12 adhered to the default versions provided by Spring Boot!
Ok, I needed yet some more dependencies (and also updated to 10.0.19 and made the code slightly shorter):
This way it works, but it is ugly. (Is there a better way?)
I am going to created a ticket to update the solr client to a version with Spring Boot compatible dependencies, if that’s ok.
implementation(platform('org.springframework.boot:spring-boot-dependencies:3.2.3')) {
[
'org.eclipse.jetty:jetty-client',
'org.eclipse.jetty:jetty-http',
'org.eclipse.jetty:jetty-io',
'org.eclipse.jetty:jetty-alpn-client',
'org.eclipse.jetty:jetty-alpn-java-client',
'org.eclipse.jetty:jetty-util',
'org.eclipse.jetty:jetty-security',
'org.eclipse.jetty:jetty-server',
'org.eclipse.jetty.http2:http2-client',
'org.eclipse.jetty.http2:http2-common',
'org.eclipse.jetty.http2:http2-hpack',
'org.eclipse.jetty.http2:http2-http-client-transport'
].forEach {
implementation(it) {
version {
strictly '10.0.19'
}
because 'A12 needs a version of the jetty client, that is older than the one configured by Spring Boot dependencies'
}
}
}