-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Won't Do
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: REST
-
Tags:
-
Sprint:nxplatform #15
-
Story Points:3
Description of the issue
Nuxeo Java Client and more widely Nuxeo Platform is using Jackson 2.10.2
<jackson.version>2.10.2</jackson.version>
When using the Nuxeo client inside a Java application using Jackson 2.11, all calls fail:
Client side error
org.nuxeo.client.spi.NuxeoClientException: Converter Read Issue. See NuxeoConverterFactory#readJSON at org.nuxeo.client.marshaller.NuxeoConverterFactory.readJSON(NuxeoConverterFactory.java:98) at org.nuxeo.client.NuxeoClient.handleResponse(NuxeoClient.java:315) at org.nuxeo.client.NuxeoClient.fetchResponse(NuxeoClient.java:275) at org.nuxeo.client.objects.AbstractConnectable.fetchResponse(AbstractConnectable.java:65) at org.nuxeo.client.objects.Repository.createDocumentByPath(Repository.java:149) at com.crawfordtech.proarchiver.plugin.storenuxeo.DocumentUploaderREST.upload(DocumentUploaderREST.java:66) at com.crawfordtech.proarchiver.plugin.storenuxeo.ParseOutDocuments.makeDoc(ParseOutDocuments.java:497) at com.crawfordtech.proarchiver.plugin.storenuxeo.ParseOutDocuments.parceAndStore(ParseOutDocuments.java:240) at com.crawfordtech.proarchiver.plugin.storenuxeo.StoreNuxeoPlugin.run(StoreNuxeoPlugin.java:184) at com.acartus.apertureone.tampa.server.javaplugininterface.JavaPluginInterface.prerun(Unknown Source) at com.acartus.apertureone.tampa.server.util.PluginRunner.restartPlugin(Unknown Source) at com.acartus.apertureone.tampa.server.ProcessingNode.restartTask(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source) at sun.rmi.transport.Transport$1.run(Unknown Source) at sun.rmi.transport.Transport$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Unknown Source) at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Invalid type definition for type `org.nuxeo.client.spi.NuxeoClientRemoteException`: Argument #0 has no property name, is not Injectable: can not use as Creator [constructor for org.nuxeo.client.spi.NuxeoClientRemoteException, annotations: {interface com.fasterxml.jackson.annotation.JsonCreator=@com.fasterxml.jackson.annotation.JsonCreator(mode=DEFAULT)}] at [Source: (String)"{"entity-type":"exception","status":500,"message":"Json object does not contain an entity-type field as expected"}"; line: 1, column: 1] at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:62) at com.fasterxml.jackson.databind.DeserializationContext.reportBadTypeDefinition(DeserializationContext.java:1589) at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._addExplicitPropertyCreator(BasicDeserializerFactory.java:630) at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._addExplicitAnyCreator(BasicDeserializerFactory.java:661) at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._addDeserializerConstructors(BasicDeserializerFactory.java:411) at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._constructDefaultValueInstantiator(BasicDeserializerFactory.java:283) at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findValueInstantiator(BasicDeserializerFactory.java:224) at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.buildThrowableDeserializer(BeanDeserializerFactory.java:376) at com.fasterxml.jackson.databind.deser.BeanDeserializerFactory.createBeanDeserializer(BeanDeserializerFactory.java:112) at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer2(DeserializerCache.java:414) at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:349) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264) at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244) at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142) at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:491) at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4669) at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4478) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3434) at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3402) at org.nuxeo.client.marshaller.NuxeoConverterFactory.readJSON(NuxeoConverterFactory.java:96) ... 28 more
Server side error
2020-07-15T19:14:29,564 ERROR [WebEngineExceptionMapper] org.nuxeo.ecm.core.io.registry.MarshallingException: Json object does not contain an entity-type field as expected org.nuxeo.ecm.core.io.registry.MarshallingException: Json object does not contain an entity-type field as expected at org.nuxeo.ecm.core.io.marshallers.json.EntityJsonReader.read(EntityJsonReader.java:59) ~[nuxeo-core-io-10.10.jar:?] at org.nuxeo.ecm.core.io.marshallers.json.AbstractJsonReader.read(AbstractJsonReader.java:80) ~[nuxeo-core-io-10.10.jar:?] at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.read(DocumentModelJsonReader.java:95) ~[nuxeo-core-io-10.10.jar:?] at org.nuxeo.ecm.core.io.marshallers.json.document.DocumentModelJsonReader.read(DocumentModelJsonReader.java:79) ~[nuxeo-core-io-10.10.jar:?] at org.nuxeo.ecm.webengine.jaxrs.coreiodelegate.PartialCoreIODelegate.readFrom(PartialCoreIODelegate.java:127) ~[nuxeo-webengine-jaxrs-10.10.jar:?] at com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:490) ~[jersey-server-1.19.4.jar:1.19.4] at com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$EntityInjectable.getValue(EntityParamDispatchProvider.java:123) ~[jersey-server-1.19.4.jar:1.19.4] at com.sun.jersey.server.impl.inject.InjectableValuesProvider.getInjectableValues(InjectableValuesProvider.java:86) ~[jersey-server-1.19.4.jar:1.19.4] at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$EntityParamInInvoker.getParams(AbstractResourceMethodDispatchProvider.java:153) ~[jersey-server-1.19.4.jar:1.19.4] ...
When looking at the actual payload sent by the client:
Payload when using Jakson 2.10.2
{ "path": null, "type": "File", "state": null, "lockOwner": null, "lockCreated": null, "versionLabel": null, "isCheckedOut": null, "lastModified": null, "contextParameters": {}, "changeToken": null, "facets": null, "parentRef": null, "uid": null, "title": null, "name": "000001-62faabb9-ee9f-4247-bede-219acf928e95", "retainUntil": null, "versionableId": null, "id": null, "locked": false, "proxy": false, "version": false, "underRetentionOrLegalHold": false, "checkedOut": null, "record": false, "trashed": false, "lock": null, "entity-type": "document", "repository": null, "properties": {}, "isProxy": false, "isTrashed": null, "isRecord": false, "hasLegalHold": false, "isUnderRetentionOrLegalHold": false, "isVersion": false }
Payload when using Jackson 2.11
{ "isVersion": false, "path": null, "type": "File", "state": null, "lockOwner": null, "lockCreated": null, "versionLabel": null, "isCheckedOut": null, "lastModified": null, "contextParameters": {}, "changeToken": null, "facets": null, "parentRef": null, "uid": null, "title": null, "name": "000001-a155bd29-de8e-4323-981f-41d2da4d0cf6", "retainUntil": null, "versionableId": null, "id": null, "locked": false, "proxy": false, "version": false, "record": false, "trashed": false, "lock": null, "checkedOut": null, "underRetentionOrLegalHold": false }
Questions
Understand the problem
The fact that upgrading from 2.10.2 to 2.11 breaks the formatting of the marshaling without raising an error on the client-side is surprising.
Are we badly using something it Jackson 2.10 ?
Compatibility
The goal of the Nuxeo Java Client is to be easily embedded inside the client App.
Unless we find a way to make our code less sensitive to the version of Jackson, we may want to consider the possibility to deliver a "fat-jar" using the maven shade plugin.