Skip to content
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

Error in deserialization of JSON #451

Closed
IgorMaksymov opened this issue Mar 15, 2018 · 17 comments
Closed

Error in deserialization of JSON #451

IgorMaksymov opened this issue Mar 15, 2018 · 17 comments

Comments

@IgorMaksymov
Copy link

i'm trying to send application/x-www-form-urlencoded request with body
to:[email protected]

this is the test code:
new MockServerClient("localhost", 1080) .when(request("/messages") .withMethod("POST") .withQueryStringParameter(Parameter.param("to","[email protected]")) ) .respond(response().withStatusCode(200));
And when this code is executed, i have this exception:
IllegalArgumentException: Exception while parsing [{ "httpRequest" : { "method" : "POST", "path" : "/messages", "queryStringParameters" : { "to" : [ "[email protected]" ] } }, "httpResponse" : { "statusCode" : 200 }, "times" : { "remainingTimes" : 0, "unlimited" : true }, "timeToLive" : { "unlimited" : true } }] for Expectation

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of java.lang.String out of FIELD_NAME token at [Source: (String)"{ "httpRequest" : { "method" : "POST", "path" : "/messages", "queryStringParameters" : { "to" : [ "[email protected]" ] } }, "httpResponse" : { "statusCode" : 200 }, "times" : { "remainingTimes" : 0, "unlimited" : true }, "timeToLive" : { "unlimited" : true } }"

How can i bypass or fix this?

@CarlosLoboZamarro
Copy link

I have the same problem.

Any ideas to fix this error?

@CarlosLoboZamarro
Copy link

CarlosLoboZamarro commented Mar 22, 2018

Hi @IgorMaksymov ,

To what I have seen at the moment, it seems that the problem is for the com.fasterxml.jackson.core:jackson-databind:2.9.4 library.

For the moment to bypass the error I have forced the use of the com.fasterxml.jackson.core:jackson-databind:2.9.3 library.

@IgorMaksymov
Copy link
Author

@CarlosLoboZamarro thanks!
In your explanation conflict and fix versions are the same.
@jamesdbloom could you fix this issue? Because spring boot 2 provides this jackson dependency and its not good to exclude it from parent

@CarlosLoboZamarro
Copy link

CarlosLoboZamarro commented Mar 22, 2018

Sorry @IgorMaksymov ,

I wanted to say com.fasterxml.jackson.core:jackson-databind:2.9.3 library.

@bric3
Copy link

bric3 commented Apr 5, 2018

For more data, here's the code that di thrown an error for me :

        oauthServer.when(
            request("/oauth/v2/access_token")
                .withMethod("GET")
                .withHeader("X-Correlation-Id", "70b10973-a064-41da-8a5b-5a4dacca9d15")
                .withQueryStringParameter("grant_type", "client_credentials")
                .withQueryStringParameter("scope", "SCOPE")
                .withHeader("authorization", "Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0"))
                   .respond(response().withStatusCode(200)
                                      .withBody("{\"access_token\":\"the_great_access_token\",\"expires_in\":1000}"));

Upon debugging the deserializer complains about deserializing this array "grant_type" : [ "client_credentials" ].

Here's a whole stack trace :

11:44:53.828 [tLoopGroup-19-2] ERROR o.m.c.serialization.ExpectationSerializer:73  - Exception while parsing [{
  "httpRequest" : {
    "method" : "GET",
    "path" : "/oauth/v2/access_token",
    "queryStringParameters" : {
      "grant_type" : [ "client_credentials" ],
      "scope" : [ "SCOPE" ]
    },
    "headers" : {
      "X-Correlation-Id" : [ "70b10973-a064-41da-8a5b-5a4dacca9d15" ],
      "authorization" : [ "Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0" ]
    }
  },
  "httpResponse" : {
    "statusCode" : 200,
    "body" : "{\"access_token\":\"the_great_access_token\",\"expires_in\":1000}"
  },
  "times" : {
    "remainingTimes" : 0,
    "unlimited" : true
  },
  "timeToLive" : {
    "unlimited" : true
  }
}] for Expectation 

com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of FIELD_NAME token
 at [Source: (String)"{
  "httpRequest" : {
    "method" : "GET",
    "path" : "/oauth/v2/access_token",
    "queryStringParameters" : {
      "grant_type" : [ "client_credentials" ],
      "scope" : [ "SCOPE" ]
    },
    "headers" : {
      "X-Correlation-Id" : [ "70b10973-a064-41da-8a5b-5a4dacca9d15" ],
      "authorization" : [ "Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0" ]
    }
  },
  "httpResponse" : {
    "statusCode" : 200,
    "body" : "{\"access_token\":\"the_great_access_token\",\"expires_in\":1000}"
  },
  "time"[truncated 108 chars]; line: 6, column: 7] (through reference chain: org.mockserver.client.serialization.model.ExpectationDTO["httpRequest"]->org.mockserver.client.serialization.model.HttpRequestDTO["queryStringParameters"])
	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
	at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1138)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1092)
	at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:63)
	at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:10)
	at com.fasterxml.jackson.databind.DeserializationContext.readValue(DeserializationContext.java:759)
	at com.fasterxml.jackson.databind.DeserializationContext.readValue(DeserializationContext.java:746)
	at org.mockserver.client.serialization.deserializers.string.NottableStringDeserializer.deserialize(NottableStringDeserializer.java:44)
	at org.mockserver.client.serialization.deserializers.string.NottableStringDeserializer.deserialize(NottableStringDeserializer.java:19)
	at com.fasterxml.jackson.databind.DeserializationContext.readValue(DeserializationContext.java:759)
	at com.fasterxml.jackson.databind.DeserializationContext.readValue(DeserializationContext.java:746)
	at org.mockserver.client.serialization.deserializers.collections.KeysToMultiValuesDeserializer.deserializeObject(KeysToMultiValuesDeserializer.java:48)
	at org.mockserver.client.serialization.deserializers.collections.KeysToMultiValuesDeserializer.deserialize(KeysToMultiValuesDeserializer.java:35)
	at org.mockserver.client.serialization.deserializers.collections.KeysToMultiValuesDeserializer.deserialize(KeysToMultiValuesDeserializer.java:22)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:288)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:151)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4001)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2992)
	at org.mockserver.client.serialization.ExpectationSerializer.deserialize(ExpectationSerializer.java:68)
	at org.mockserver.client.serialization.ExpectationSerializer.deserializeArray(ExpectationSerializer.java:101)
	at org.mockserver.mock.HttpStateHandler.handle(HttpStateHandler.java:218)
	at org.mockserver.mockserver.MockServerHandler.channelRead0(MockServerHandler.java:64)
	at org.mockserver.mockserver.MockServerHandler.channelRead0(MockServerHandler.java:37)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:108)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at org.mockserver.unification.PortUnificationHandler.switchToHttp(PortUnificationHandler.java:188)
	at org.mockserver.unification.PortUnificationHandler.channelRead0(PortUnificationHandler.java:91)
	at org.mockserver.unification.PortUnificationHandler.channelRead0(PortUnificationHandler.java:37)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1342)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:934)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
	at java.lang.Thread.run(Thread.java:748)

12:09:06.416 [ntLoopGroup-3-2] ERROR   org.mockserver.logging.LoggingFormatter:52  - Exception processing {
  "method" : "PUT",
  "path" : "/expectation",
  "headers" : {
    "host" : [ "localhost:50094" ],
    "accept-encoding" : [ "gzip,deflate" ],
    "content-length" : [ "608" ],
    "connection" : [ "keep-alive" ],
    "content-type" : [ "text/plain; charset=utf-8" ]
  },
  "keepAlive" : true,
  "secure" : false,
  "body" : {
    "type" : "STRING",
    "string" : "{\n  \"httpRequest\" : {\n    \"method\" : \"GET\",\n    \"path\" : \"/oauth/v2/access_token\",\n    \"queryStringParameters\" : {\n      \"grant_type\" : [ \"client_credentials\" ],\n      \"scope\" : [ \"SCOPE\" ]\n    },\n    \"headers\" : {\n      \"X-Correlation-Id\" : [ \"31214398-0a07-443f-9d7d-299b2a9d1946\" ],\n      \"authorization\" : [ \"Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0\" ]\n    }\n  },\n  \"httpResponse\" : {\n    \"statusCode\" : 200,\n    \"body\" : \"{\\\"access_token\\\":\\\"the_great_access_token\\\",\\\"expires_in\\\":1000}\"\n  },\n  \"times\" : {\n    \"remainingTimes\" : 0,\n    \"unlimited\" : true\n  },\n  \"timeToLive\" : {\n    \"unlimited\" : true\n  }\n}",
    "contentType" : "text/plain; charset=utf-8"
  }
} 

java.lang.RuntimeException: Exception while parsing [{
  "httpRequest" : {
    "method" : "GET",
    "path" : "/oauth/v2/access_token",
    "queryStringParameters" : {
      "grant_type" : [ "client_credentials" ],
      "scope" : [ "SCOPE" ]
    },
    "headers" : {
      "X-Correlation-Id" : [ "31214398-0a07-443f-9d7d-299b2a9d1946" ],
      "authorization" : [ "Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0" ]
    }
  },
  "httpResponse" : {
    "statusCode" : 200,
    "body" : "{\"access_token\":\"the_great_access_token\",\"expires_in\":1000}"
  },
  "times" : {
    "remainingTimes" : 0,
    "unlimited" : true
  },
  "timeToLive" : {
    "unlimited" : true
  }
}] for Expectation
	at org.mockserver.client.serialization.ExpectationSerializer.deserialize(ExpectationSerializer.java:74)
	at org.mockserver.client.serialization.ExpectationSerializer.deserializeArray(ExpectationSerializer.java:101)
	at org.mockserver.mock.HttpStateHandler.handle(HttpStateHandler.java:218)
	at org.mockserver.mockserver.MockServerHandler.channelRead0(MockServerHandler.java:64)
	at org.mockserver.mockserver.MockServerHandler.channelRead0(MockServerHandler.java:37)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:108)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:438)
	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:310)
	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:284)
	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:253)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at org.mockserver.unification.PortUnificationHandler.switchToHttp(PortUnificationHandler.java:188)
	at org.mockserver.unification.PortUnificationHandler.channelRead0(PortUnificationHandler.java:91)
	at org.mockserver.unification.PortUnificationHandler.channelRead0(PortUnificationHandler.java:37)
	at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1342)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:934)
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138)
	at java.lang.Thread.run(Thread.java:748)
Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of FIELD_NAME token
 at [Source: (String)"{
  "httpRequest" : {
    "method" : "GET",
    "path" : "/oauth/v2/access_token",
    "queryStringParameters" : {
      "grant_type" : [ "client_credentials" ],
      "scope" : [ "SCOPE" ]
    },
    "headers" : {
      "X-Correlation-Id" : [ "31214398-0a07-443f-9d7d-299b2a9d1946" ],
      "authorization" : [ "Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0" ]
    }
  },
  "httpResponse" : {
    "statusCode" : 200,
    "body" : "{\"access_token\":\"the_great_access_token\",\"expires_in\":1000}"
  },
  "time"[truncated 108 chars]; line: 6, column: 7] (through reference chain: org.mockserver.client.serialization.model.ExpectationDTO["httpRequest"]->org.mockserver.client.serialization.model.HttpRequestDTO["queryStringParameters"])
	at com.fasterxml.jackson.databind.exc.MismatchedInputException.from(MismatchedInputException.java:63)
	at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1342)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1138)
	at com.fasterxml.jackson.databind.DeserializationContext.handleUnexpectedToken(DeserializationContext.java:1092)
	at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:63)
	at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:10)
	at com.fasterxml.jackson.databind.DeserializationContext.readValue(DeserializationContext.java:759)
	at com.fasterxml.jackson.databind.DeserializationContext.readValue(DeserializationContext.java:746)
	at org.mockserver.client.serialization.deserializers.string.NottableStringDeserializer.deserialize(NottableStringDeserializer.java:44)
	at org.mockserver.client.serialization.deserializers.string.NottableStringDeserializer.deserialize(NottableStringDeserializer.java:19)
	at com.fasterxml.jackson.databind.DeserializationContext.readValue(DeserializationContext.java:759)
	at com.fasterxml.jackson.databind.DeserializationContext.readValue(DeserializationContext.java:746)
	at org.mockserver.client.serialization.deserializers.collections.KeysToMultiValuesDeserializer.deserializeObject(KeysToMultiValuesDeserializer.java:48)
	at org.mockserver.client.serialization.deserializers.collections.KeysToMultiValuesDeserializer.deserialize(KeysToMultiValuesDeserializer.java:35)
	at org.mockserver.client.serialization.deserializers.collections.KeysToMultiValuesDeserializer.deserialize(KeysToMultiValuesDeserializer.java:22)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:127)
...

Here's what changed with jackson-databind 2.9.4 : https://github.com/FasterXML/jackson-databind/blob/jackson-databind-2.9.5/release-notes/VERSION-2.x#L31-L61

@bric3
Copy link

bric3 commented Apr 5, 2018

I wonder if this was introduced by this issue / change FasterXML/jackson-databind#1853

@lassounski
Copy link

I used version 5.1.1 and it worked.

        <dependency>
            <groupId>org.mock-server</groupId>
            <artifactId>mockserver-netty</artifactId>
            <version>5.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.mock-server</groupId>
            <artifactId>mockserver-client-java</artifactId>
            <version>5.1.1</version>
        </dependency>

@nathanabercrombie
Copy link

Also fails for jackson 2.8.11, which is a hotfix for a CVE. And the issue is gone in 2.9.2 (which doesn't have a hotfix for the CVE), and then fails again in 2.9.5. I didn't try 2.9.3 or 2.9.4 yet though. But the hotfix in 2.8.11 may be a clue.

@dalbani
Copy link

dalbani commented May 8, 2018

Jackson 2.9.3 does work fine, as mentioned here previously.

@nathanabercrombie
Copy link

Agreed, 2.9.3 does work. 2.9.4 doesn't.

@yanivnahoum
Copy link

2.9.5 doesn't work either. Same error as 2.9.4

@jamesdbloom
Copy link
Collaborator

There is a bug in Jackson from version 2.9.4 onwards. The bug is because Jackson invalidly prevents deserialisation of JSON fields names for objects unless those objects are deserialised as a Map.

I have however worked around this bug with d267a2d.

@bric3
Copy link

bric3 commented Jun 19, 2018

@jamesbloomnektan Do you have the jackson issue ticket ?

@nathanabercrombie
Copy link

nathanabercrombie commented Jul 2, 2018

@jamesbloomnektan Did your fix get released to maven central yet?

@yanivnahoum
Copy link

yanivnahoum commented Jul 2, 2018 via email

@nathanabercrombie
Copy link

nathanabercrombie commented Jul 2, 2018

Works great! Thanks

(Side note: You changed the names of some methods without having some deprecation period. I was on 5.3.0 and the method callback existed, now its called respond. That kind of change without a @Deprecated warning is kind of annoying)

@DavidRigglemanININ
Copy link

Is there plans to update the mockserver maven plugin soon to use the latest version and to pull in this fix?

lanwen added a commit to lanwen/testcontainers-java that referenced this issue Aug 14, 2018
bsideup pushed a commit to testcontainers/testcontainers-java that referenced this issue Aug 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants