Closed pmauduit closed 1 year ago
i've had a quick look and in the maven dependency tree only jackson 2.10.2 is pulled as a direct dependency of https://mvnrepository.com/artifact/com.github.java-json-tools/json-patch/1.12 - so i don't understand what pulls 2.13.1.
maybe a tomcat (regular deployment) vs jetty (docker) issue if it only shows there ?
maybe a tomcat (regular deployment) vs jetty (docker) issue if it only shows there ?
no, the docker image is also making use of tomcat
dunno if that'd be a smart move or not, but maybe one of the versions can be excluded from the war via packagingExcludes
as done in c008b965dd ?
currently experiencing it on https://demo.georchestra.org/mapstore/ (deployed with ansible so tomcat+wars) where loading localConfig.json fails with a 500 code (cf https://demo.georchestra.org/mapstore/configs/localConfig.json):
HTTP Status 500 – Internal Server Error
Type Exception Report
Message Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: 'java.lang.String[] com.fasterxml.jackson.annotation.JsonSubTypes$Type.names()'
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.springframework.web.util.NestedServletException: Handler dispatch failed; nested exception is java.lang.NoSuchMethodError: 'java.lang.String[] com.fasterxml.jackson.annotation.JsonSubTypes$Type.names()'
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1082)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:963)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898)
javax.servlet.http.HttpServlet.service(HttpServlet.java:626)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
javax.servlet.http.HttpServlet.service(HttpServlet.java:733)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause
java.lang.NoSuchMethodError: 'java.lang.String[] com.fasterxml.jackson.annotation.JsonSubTypes$Type.names()'
com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector.findSubtypes(JacksonAnnotationIntrospector.java:628)
com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver._collectAndResolveByTypeId(StdSubtypeResolver.java:296)
com.fasterxml.jackson.databind.jsontype.impl.StdSubtypeResolver.collectAndResolveSubtypesByTypeId(StdSubtypeResolver.java:212)
com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findTypeDeserializer(BasicDeserializerFactory.java:1794)
com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.createCollectionDeserializer(BasicDeserializerFactory.java:1367)
something is really wrong here. @tdipisa @offtherailz any idea ?
@landryb @pmauduit it's something we fixed on the MS side as well as some other downstream MS projects when working on https://github.com/geosolutions-it/MapStore2/pull/8764 It is possible to fix this by including the following MVN dependencyManagement block in the root pom file here:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.13.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.1</version>
</dependency>
</dependencies>
</dependencyManagement>
and then adding the following in web/pom here:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
That should fix the problem.
Thanks @landryb for the fix Could you also remake the docker image for georchestra/mapstore:2022.02.00-geOrchestra version with your modification ?
I've looked at the GitHub actions workflow and all of what's needed is to create a new release (with a new tag) for publishing the new docker image: https://github.com/georchestra/mapstore2-georchestra/blob/master/.github/workflows/mapstore.yml#L115
you guys know better than me how this whack-a-mole works, feel free to do whatever is needed :)
Describe the bug
Encountered with the
georchestra/mapstore:2022.02.00-geOrchestra
docker image, but also on the webapp deployed on demo.georchestra.org/mapstore/ : there are several different and incompatible jackson versions in the classpath:if one are lucky (on demo.georchestra.org it works), the expected - 2.13.1 - version is loaded, and there are no issue, but if not, one can get the following error trying to access the config.json endpoint:
To Reproduce
deploy the webapp, the docker image is likely to reproduce but since the loading order of the jars in the classpath is not predictible, it can work as it can fail.
Expected behavior
Only one version - 2.13.1 - is available in the classpath.
Desktop (please complete the following information):
Additional context
It seems to fail in a docker environment, but okay-ish in a regular setup (demo.georchestra.org is making use of the georchestra/ansible playbook to automate the setup/configuration).