Sebastian Frey (
https://osgeo-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A2edf9d89-a043-47ec-80ad-02af3d85b5f1
) *created* an issue
GeoServer (
https://osgeo-org.atlassian.net/browse/GEOS?atlOrigin=eyJpIjoiOWI3MmVhY2I0NWE2NDRkMWFkMjMwOWU2NTA2MjBlMDkiLCJwIjoiaiJ9
) / Bug (
https://osgeo-org.atlassian.net/browse/GEOS-10828?atlOrigin=eyJpIjoiOWI3MmVhY2I0NWE2NDRkMWFkMjMwOWU2NTA2MjBlMDkiLCJwIjoiaiJ9
) GEOS-10828 (
https://osgeo-org.atlassian.net/browse/GEOS-10828?atlOrigin=eyJpIjoiOWI3MmVhY2I0NWE2NDRkMWFkMjMwOWU2NTA2MjBlMDkiLCJwIjoiaiJ9
) OGC API - Features - Plugin breaks core `/rest` API with JSON payloads (
https://osgeo-org.atlassian.net/browse/GEOS-10828?atlOrigin=eyJpIjoiOWI3MmVhY2I0NWE2NDRkMWFkMjMwOWU2NTA2MjBlMDkiLCJwIjoiaiJ9
)
Issue Type: Bug Assignee: Unassigned Created: 17/Jan/23 2:44 PM Priority:
Medium Reporter: Sebastian Frey (
https://osgeo-org.atlassian.net/secure/ViewProfile.jspa?accountId=557058%3A2edf9d89-a043-47ec-80ad-02af3d85b5f1
)
When using the latest version of the OGC API plugin, the core /rest API breaks
with JSON payloads. For example, than it is no longer possible to create a
workspace by using a JSON payload.
Steps to reproduce:
1. Download latest GeoServer WAR and latest OGC API plugin.
2. Deploy it within Tomcat.
3. Try to create a workspace as follows:
curl -v -u admin:geoserver -X POST \
-H "Content-type: application/json" \
-d '{"workspace":{"name":"test"}}' \
http://localhost:8080/geoserver/rest/workspaces
Within the GeoServer logs you will find the following stack trace:
17 Jan 14:35:19 ERROR [geoserver.rest] - Type definition error: [simple type,
class org.geoserver.catalog.WorkspaceInfo]; nested exception is
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct
instance of `org.geoserver.catalog.WorkspaceInfo` (no Creators, like default
constructor, exist): abstract types either need to be mapped to concrete types,
have custom deserializer, or contain additional type information
at [Source: (PushbackInputStream); line: 1, column: 1]
org.springframework.http.converter.HttpMessageConversionException: Type
definition error: [simple type, class org.geoserver.catalog.WorkspaceInfo];
nested exception is
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot construct
instance of `org.geoserver.catalog.WorkspaceInfo` (no Creators, like default
constructor, exist): abstract types either need to be mapped to concrete types,
have custom deserializer, or contain additional type information
at [Source: (PushbackInputStream); line: 1, column: 1]
at
org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:282)
at
org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.read(AbstractJackson2HttpMessageConverter.java:243)
at
org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolver.readWithMessageConverters(AbstractMessageConverterMethodArgumentResolver.java:205)
at
org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:158)
at
org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:131)
at
org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121)
at
org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:167)
at
org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134)
at
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:878)
at
org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:792)
... 93 more
Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException:
Cannot construct instance of `org.geoserver.catalog.WorkspaceInfo` (no
Creators, like default constructor, exist): abstract types either need to be
mapped to concrete types, have custom deserializer, or contain additional type
information
at [Source: (PushbackInputStream); line: 1, column: 1]
at
com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:67)
at
com.fasterxml.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1904)
at
com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:400)
at
com.fasterxml.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1349)
at
com.fasterxml.jackson.databind.deser.AbstractDeserializer.deserialize(AbstractDeserializer.java:274)
at
com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:323)
at
com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4674)
at
com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3682)
at
org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:274)
... 104 more
On further investigations I have noticed that the OGC API plugin registers a
custom MappingJackson2HttpMessageConverter :
https://github.com/geoserver/geoserver/blob/main/src/community/ogcapi/ogcapi-core/src/main/java/org/geoserver/ogcapi/APIDispatcher.java#L156
(
https://github.com/geoserver/geoserver/blob/main/src/community/ogcapi/ogcapi-core/src/main/java/org/geoserver/ogcapi/APIDispatcher.java#L156
)
By commenting out this line, the core /rest API does not break and the above
request works as expected.
Just an idea: It seems like that some Jackson mappers are lost from core, when
the OGC API plugin registers the custom converter.
(
https://osgeo-org.atlassian.net/browse/GEOS-10828#add-comment?atlOrigin=eyJpIjoiOWI3MmVhY2I0NWE2NDRkMWFkMjMwOWU2NTA2MjBlMDkiLCJwIjoiaiJ9
) Add Comment (
https://osgeo-org.atlassian.net/browse/GEOS-10828#add-comment?atlOrigin=eyJpIjoiOWI3MmVhY2I0NWE2NDRkMWFkMjMwOWU2NTA2MjBlMDkiLCJwIjoiaiJ9
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira.core&referrer=utm_source%3DNotificationLink%26utm_medium%3DEmail
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=EmailNotificationLink&mt=8
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100214-
sha1:771690a )
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel