-
Notifications
You must be signed in to change notification settings - Fork 40.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jackson 2.8.x dependency problem w/ Elasticsearch 2.3.x by managed dependencies of Spring Boot 1.4.0 #6508
Comments
added a simple test case agebhar1/spring-boot-6508-jackson-elasticsearch |
This affects jest-2.0.3 functionality integration with spring-boot-starter-data-elasticsearch as well |
This problem is seen only in the embedded elasticsearch scenario. When used against a standalone elasticsearch, this is not a problem. In my case, I use the embedded elasticsearch for unit testing. One temporary workaround for me was to hardcode the jackson dependencies to version 2.6.6 and change the scope to test so that these older jackson libraries are not transitively passed down. |
This issue also happens with standalone elasticsearch when using elasticsearch java library as client. Downgrading Jackson to version 2.7.5 fixes the issue. This is not a Spring boot issue, it's elasticsearch which should upgrade to Jackson 2.8.x. |
I have the same issue, I'm using spring-data-elasticsearch-2.0.2.RELEASE. I've downgraded my Jackson dependency to 2.7.6 and it solved the issue, at least for now. |
We're stuck between a rock and a hard place with this one. I don't think we want to downgrade our Jackson version just for Elasticsearch but we should document that a downgrade is necessary. |
Perhaps we could also throw a nicer error if we detect an invalid combination. |
@philwebb Did you have something in mind to accomplish/detect it? |
@agebhar1 I was thinking something in the Elasticsearch auto-configuration could check that the correct Jackson version is being used and fail hard if it's not. |
We're going to drop back to Jackson 2.7.x and add a test that checks that Jackson and Elasticsearch are playing nicely together. |
@jhoeller Is there any problem with dropping back to 2.7.x from the framework's perspective? |
Nope, we support Jackson 2.6+ and just recommend 2.7.x or - for the ambitious - 2.8.x at this point. |
@wilkinsona I already create a simple test case (see 2nd comment) which I can contribute. Should the test case one Java file or should it be included somewhere else? |
Apologies for breakage here. I was hoping that co-variant return type would work in this case, but realize now that it does not (since method signature is still different even if there are no intermediate assignments). If anyone can suggest something to help with 2.8.2 I would be happy to add a patch, but am not sure there is much that can be done. |
@cowtowncoder I can't see any obvious way to fix it. Hopefully Elasticsearch can provide a patch. |
@philwebb Unfortunately it is a tricky problem, and I underestimated part of binary incompatibility issue and only solved source-compatibility part in the end. |
We need to remove the dependency management for jackson-datatype-jaxrs which is new in 2.8 |
Added jackson Dependency to build.sbt works fine now |
In 1.4.0 we used Elasticsearch 2.3.5 and Jackson 2.8. This combination was incompatible in some circumstances due to a change in Jackson (gh-6508). With Elasticsearch 2.4 yet to be released at the time, the only way to restore compatibility was to downgrade Jackson. With the release of Elasticsearch 2.4 we have another option: revert the Jackson downgrade and upgrade Elasticsearch instead. While we normally wouldn't consider upgrading to a new minor version of a dependency in a maintenance release we have to do something to restore compatibility. The alternative is to downgrade Jackson but that will affect more people (Jackson is more widely used than Elasticsearch) and will lose some functionality that was new in Jackson 2.8 that people may already be relying upon. This commit restores the use of Jackson 2.8 – including the 2.8-specific dependency management – and upgrades to Elasticsearch 2.4 Closes gh-6868
cool ... |
After upgrade from Spring Boot v1.3.5 to v1.4.0 with a embedded Elasticsearch node the application is broken by
NoSuchMethodError
:The problematic code from Elasticsearch (
JsonXContentGenerator:327
)Elasticsearch (v2.3.4) depends on Jackson v2.6.6 and is managed by Spring Boots provided version v2.8.1. In Jackson's
GeneratorBase
v2.6 the return type isJsonWriteContext
which has a method
writeValue()
but inGeneratorBase
v2.8 the return type is changed to it's super typeJsonStreamContext
The current provided version of Jackson breaks usage of Elasticsearch with out-of-the-box Spring Boots 1.4 managed dependencies.
The text was updated successfully, but these errors were encountered: